SAS Programming Fundamentals
Test your knowledge of SAS programming concepts including data steps, procedures, options, and data manipulation techniques.
Questions
data new; x = '1000'; y= x * .10; run; What is the result?
- y = '100'
- y = 100 and a NOTE is written in the SAS log saying that character value has been converted to numeric value
- y = 100 and no NOTE is written in the SAS log
- Program does not execute due to Syntax Errors
proc print data=sales; run; options ? proc means data=sales; run; Which option statement has to be used to reset the page number to 3 for the second report?
- options reset pagenum=3;
- options reset pageno=3;
- options pageno=3;
- options pagenum=3;
data quote; infile datalines dlm=','; input x y$; datalines; 10,"100" ; run; What will be the output?
- x y {10 }
- Syntax Error due to the double quotes
- x y { 10 "100" }
- x y { 10 100 }
data count; array x{3} (1,2,3); run; What is the result?
- No observations.No variables
- variable x is created with 3 observations with values 1,2 and 3
- Array should be given a name during initialization.Syntax Error
- The variables x1 , x2 and x3 are created with the values 1, 2 and 3
The output required from proc means is min, max and nmiss.Also the decimal values should be aligned to 2 digits.Which proc statement satisfies the requirement
- proc means; ( min max nmiss maxdec=2);
- proc means; var x /min max nmiss maxdec=2;
- proc means min max nmiss maxdec=2;
- proc means; var x ( min max nmiss maxdec=2);
The option available for displaying proc freq for getting a cross tabulation of the fields product and region is
- tables product/region;
- tables product * region;
- tables product,region;
- tables product region;
which of the following proc statement can be used to delete all the SAS datasets present in the library MyWork
- proc datasets lib=Mywork kill ;run;
- proc datasets lib=Mywork delete ;run;
- proc datasets; lib=Mywork delete ;run;
- proc datasets lib=Mywork erase ;run;
The option to give in order to make SAS to continue processing even if there are any formats that is given in the sas program is not available is
- options NOFMT;
- options NOFMTERR;
- options FMTERR;
- options NOERR;
proc format; value num 1-6 = 'High' 6-10= 'Low'; run;
- Format is not created
- Format is created with the name of num
- ERROR: These two ranges overlap: 1-6 and 6-10 (fuzz=1E-12).
- Syntax Error
data y; set x; length a $12; run; In the dataset x there is a variable called a which is numeric and of length 8.What is the result of this data step?
- No observations in dataset y
- variable a in dataset y will be numeric and of length 8
- variable a in dataset y will be character and of length 12
- Error since the variable a is defined as both character and numeric
There are 2 datasets sales and income.Sales has a variable pno and income has a variable product.Both are same.The third dataset has to be formed by merging sales and income that has the same products.Which is the correct option?
- data new;set income(in=IN_A rename=( product = pno)) sales(in=in_b); if IN_A and IN_B;run;
- data new;merge income(in=IN_A) (rename( product = pno)) sales(in=IN_B);run;
- data new;merge income(in=IN_A) (rename=( product = pno)) sales(in=IN_B);if IN_A and IN_B;run;
- data new;merge income(in=IN_A rename=( product = pno)) sales(in=in_b); if IN_A and IN_B;run;
Which macro variable contains the value of current date
- SYSDATE9
- DATE10
- SYSTIME
- DATE6
The report output should be {x y } {1 2} {2 5} {Total 2} Choose the correct option. NOTE { } are added for readability
- proc print data = new N='total';
- proc print data = new sum='total';
- proc print data = new; sum/ label='total';
- proc print data = new sum; label='total';
The default number of error messages that are displayed in SAS log is
- 3
- 6
- 5
- 20
In order to write each input record into the log the option used is
- put ;
- put list;
- list;
- put LIST;
To display all the values of all the variables in the log, the option used is
- put ALLVAR
- put VAR
- put ALL;
- put ;
x=intck('week.4','01JAN2010'd,'01FEB2010'd); What is the value of x ?
- 0
- Syntax Error - week.4
- 5
- 4