SAS Base Programming Review - Numeric Answers Only

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

The following SAS program is submitted. Data hw4; X= '2000.5'; Y=0.10*x; Run; What is the value of Y?

200.05

At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is 0, and the values of the remaining variables are set to:

missing

At the start of DATA step processing, during the compilation phase, variables are created in the program data vector (PDV), and observations are set to:

none - (not missing or 0, just none)

Assume that Work.Ds1 and Work.Ds2 exist and the following SAS program is submitted: ods pdf file='results.pdf'; proc print data=work.ds1;run; proc freq data=work.ds1; proc freq data=work.ds2; run; ods pdf close; How many PDF files are created?

1

Assuming the SAS data set test.data has more than 20 observations, how many observations are in the output from the following proc print step? Options firstobs=6 obs = 20; Data new1; set test.data; If _N_ > 9; run; PROC PRINT data = work.new1; Run;

1

When applying the following SAS function, what is the correct value from the function? FLOOR(-12.345) =

-13

When applying the following SAS function, what is the correct value from the function? ROUND(-456.78 , .1) =

-456.8

Consider the following data step: data WORK.NEW; set WORK.OLD (keep=X); if X < 10 then X=1; else if X >= 10 AND X LT 20 then X=2; else X=3; run; In filtering the values of the variable X in data set WORK.OLD, what value new value would be assigned to X if its original value was a missing value?

1

Suppose you run a program that causes three DATA step errors. What is the value of the automatic variable _ERROR_ when the observation that contains the third error is processed?

1

Suppose you run a program that causes three DATA step errors. What is the value of the variable _ERROR_ when the observation that contains the third error is processed?

1

The following SAS program is submitted: data employees; infile 'file-specification'; input @1 name $10. @15 date date9. @25 department $; run; How many numeric variables are created?

1

Assume today is Tuesday, November 24th. Weeks=INTCK('week', '24NOV2020'd, '28NOV2020'd); What is weeks equal to?

0

The data set Mylib.Heart has nine observations with Sex=1, thirteen observations with Arterial>80, and seven observations with Sex=1 and Arterial>80. How many observations does the data set FCinfo2 created below have? data FCinfo2 (keep=Heart Arterial); set Mylib.Heart (drop=Sex); if sex=1 and Arterial>80;run; proc print; run;

0

How many observations are in the output from the following program, assuming the SAS data set old has more than 20 observations: Options firstobs=6 obs = 20; Data new1; set old; Run; PROC PRINT data = work.new1; RUN;

15

The variable Name in the data set Employee has a $CHAR10. format. The variable Name in the data set Sales has a $CHAR15. format. The following SAS program is submitted: data both; length name $ 20; merge sales employee; by id; run; What is the length for the variable Name in the data set Both?

15

The following SAS program is submitted: data both; set M F(in = INF); if INF then gen = 'F'; else gen = 'M'; by name; run; The SAS data sets Work.M and Work.F are each sorted by the variable Name. The data set Work.M contains 10 observations, and the data set Work.F contains 9 observations. How many observations does the data Both contain?

19

What is the default value of the YEARCUTOFF= system option?

1920

Assume today is Tuesday, November 24th. Months=INTCK('Month', '24NOV2020'd, '01JAN2021'd); What is months equal to?

2

The following SAS program is submitted: data work.count; if OriginalAmount= . then OriginalAmount=100; AdditionalItems=100; OriginalAmount= .; TotalCount=(OriginalAmount+AdditionalItems)+0; run; What is the value of the Totalcount variable in the output data set?

200

The following SAS program is submitted. Data hw4; date= put('12Sep1975'd, ddmmyy10.); run; What is the length of the variable date?

10

The following SAS program is submitted: data work.month; date=put('13mar2000'd,ddmmyy10.); run; What is the length of the variable Date in the output data set?

10

The variable Name in the data set Employee has a $CHAR10. format. The variable Name in the data set Sales has a $CHAR15. format. The following SAS program is submitted: data both; merge employee sales; by name; run; What is the length for the variable Name in the data set Both?

10

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; firstname = scan(name,2); lastname = scan(name,1); fullname=firstname||' '||lastname; run;

101

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; firstname = trim(scan(name,2)); lastname = trim(scan(name,1)); fullname=trim(firstname)||' '||lastname; run;

101

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; firstname = scan(name,2); lastname = scan(name,1); fullname=trim(firstname||' '||lastname); length FullName $ 40; run;

101

Consider the following program: data work.investments; initial=4; do k=1 to 2; initial+2;end; sum=k+initial;run; What is the value of sum in the single observation of work.investments?

11

The following SAS program is submitted: data work.test; type='SQL'; if type='SAS' then description='SAS Program'; else description='other'; length description 8; run; What is the length of description from the program submitted?

11

data temp; set lib1.x lib2.y; length jobcode $12.; run; What would be the length of Jobcode in temp?

12

Assume the data set year_1 is created and exists in your work library. The following SAS program is submitted: Data revenue; Set year_1; Var1=mdy(1,15,1960); run; What numeric value does the variable named VAR1 contain?

14

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; Length name $ 100; set retail.maillist; firstname = scan(name,2); lastname = scan(name,1); fullname=firstname||' '||lastname; run;

200

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; firstname = scan(name,2); lastname = scan(name,1); fullname= catx (' ', firstname, lastname); run;

200

After the following program is submitted what is the stored value of Year in the last observation of the data set invest? data work.invest; do year=2009 to 2000 by -1; Capital+5000; capital+(capital*.10); output; end; run;

2000

In the data set Work.Invest, what would be the stored value for Year? data work.invest; do year=1990 to 2004; Capital+5000; capital+(capital*.10); end; run;

2005

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; Length name $ 100; firstname = scan(name,2); lastname = scan(name,1); fullname=firstname||' '||lastname; run;

201

How many characters can be used in a label?

256

Assume today is Tuesday, November 24th. Years=INTCK('Year', '24NOV2020'd, '03JAN2023'd); What is years equal to?

3

How many program steps are executed when the program below is processed? data user.tables; set work.jobs;run; proc sort data=user.tables; by name; run; proc print data=user.tables;run;

3

How many program steps are executed when the program below is processed? data user.tables; infile jobs; input date name $ job $; run; proc sort data=user.tables; by name; run; proc print data=user.tables; run;

3

Mylib.Pilots is a SAS Data set with twenty observations. How many observations are printed from the proc print step below? options firstobs=2 obs=5; data empdata2; set mylib.pilots;run; proc print data=empdata2;run;

3

What is the maximum character variable length?

32767

Based on the following code, determine the length of the variable COURSE. data hw4; course='Math610: Intro to SAS Programming'; year='03Apr2018'd; format course $char21. Year date9.; run; proc print; run;

33

You wish to create a variable FullName by concatenating last names and first names which you will extract from the variable Name. Name is in the retail.maillist data set and has values in the form lastname,firstname middlename. The length of Name is 50. What is the length of the program: data work.maillist; set retail.maillist; length FullName $ 40; firstname = scan(name,2); lastname = scan(name,1); fullname=trim(firstname)||' '||trim(lastname); run;

40

How many observations are in the output from the following program, assuming the SAS data set old has more than 20 observations: Options firstobs=6 obs = 20; Data new1; set old; If _N_ > 10; RUN; PROC PRINT data = work.new1 (firstobs = 1); RUN;

5

How many statements does the following SAS program contain? proc print data=new.prodsale label double; var state day price1 price2; where state='NC'; label state='Name of State'; run;

5

What is the minimum width of the TIMEw. informat?

5

Assuming the SAS data set test1.data has more than 20 observations, how many observations are in the output from the following program? Options firstobs=6 obs = 20; Data new1; set test1.data; If _N_ > 9; run; proc print data = work.new1 (firstobs = 1); run;

6

The data set orion.sales contains nine variables, including the variables Location, Gender, Salary, Country, and Bonus. Given the DATA step below, how many variables does the data set work.comp contain? data work.comp; set orion.sales (drop=Location); drop Gender Salary Country; Compensation=sum(Salary,Bonus);run;

6

The following SAS program is submitted: options pageno=1 number; proc print data=sasuser.houses; run; proc means data=sasuser.shoes; run; The report created by the PRINT procedure generates five pages of output. What is the page number on the first page that is generated by the MEANS procedure?

6

The following SAS program is submitted: DATA test(drop=age); SET sashelp.class(keep=name age gender height weight); drop=gender; newage=age+1; run; Sashelp.Class contains 5 variables. How many are written in the data set?

6

data test; n=1; do while(n < 6); n+1; end; run; What will be the value of n at the end of the data step?

6

How many program statements does the program below contain? data user.tables; set work.jobs; run; proc sort data=user.tables; by name; run; proc print data=user.tables; run;

8

The following SAS program is submitted: data clients; calls=2; do k=1 to 3 while(calls<4); calls+1; end; calls+1; calls=calls+k; run; proc print; run; What is the value of calls?

8

What is the default length for a numeric variable?

8

During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. Determine the number of times the DO loop executes and the number of observations in the data set finance.earnings. data finance.earnings; Amount=1000; Rate=.075/12; do month=1 to 24; Earned+(amount+earned)*rate; end; run; a. loop executes 24 times, # of observations =1 b. loop executes 25 times, # of observations =24 c. loop executes 1 time, # of observations =1 d. loop executes 24 times, # of observations =24 e. loop executes 25 times, # of observations=1

a. loop executes 24 times, # of observations =1 only prints one observation for the amount earned with interest as of the 24th moth 24 loops since beginning with one, not zero. Can produce all loop intervals with explicit output statement: data finance.earnings; Amount=1000; Rate=.075/12; do month=1 to 24; Earned+(amount+earned)*rate; output; end; run;

Using ODS statements, how many types of output can you generate concurrently?

infinity


Set pelajaran terkait

Review Sheet Drugs and Diagnosis

View Set

BUS LAW Ch. 8-Internet Law, Social Media, and Privacy

View Set

Micro Economics Study Guide Test 2

View Set

Cell Membrane Structure and Function

View Set

Production of Goods and Services

View Set