BA05 Base SAS Programming

WARNING - Clicking on the "SUBMIT ASSIGNMENT" button will submit the

Assignment. Be sure that you have reviewed your answers before clicking it. Attempt all the questions. All questions are compulsory. Each question carries 4 marks. There is No Negative Marking for wrong answer/s.

Please note: There are 25 questions out of which Q.No.21-25 are based on the Case Study.

Subject Code: BA05

Subject Name: BASE SAS PROGRAMMING

Component name: TERM END

Question 1:- We have submitted the following PROC SORT step, which generates an output data set: Proc Sort data = AV.employee out= employee; By Designation; Run; In which library is the output data set stored?

a)         Work                       

b)         AV                        

c)         SASHELP                       

d)         SASUSER                       

Question 2:- The following SAS program is submitted:

data test; set Sasuser.Employees; if years_service ge 2 and years_service le 10 then amount = 1000; else if years_service gt 10 then amount = 2000; else amount = 0; amount_per_year = years_service / amount; run; Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year?

a)         0                       

b)         1000                       

c)         2000                       

d)         . -- (Missing value)                       

Question 3:- The following SAS DATA step is submitted: data sasdata.allahabad sasdata.bhilai  work.portblair work.pune;  set company.prdsales;  if region = `NE` then output bhilai; else if region = `SE` then output allahabad;  else if region = `SW` then output pune; else if region = `NW` then output portblair;  run; 

Which one of the following is true regarding the output data sets?

a)         No library references are required                       

b)         The data sets listed on all the IF statements require a library reference                       

c)         The data sets listed in the last two IF statements require a library reference                       

d)         The data sets listed in the first two IF statements require a library reference                       

Question 4:- Which one of the following SAS DATA steps saves the temporary data set named HADOOPDATA as a permanent data set?

a)   libname sasdata `SAS-data-library`; data sasdata.hadoopdata; copy hadoopdata; run;                       

/

  libname sasdata `SAS-data-library`; data sasdata.hadoopdata; keep hadoopdata; run;                       

  libname sasdata `SAS-data-library`; data sasdata.hadoopdata; save hadoopdata; run;                          libname sasdata `SAS-data-library`; data sasdata.hadoopdata; set hadoopdata; run;                       

Question 5:- You have submitted the SAS DATA step as below: libname temp `SAS-data-library`;  data temp.employee;  set sasuser.employer;  totalsal = price * 1.04;  run; 

Which one of the following statements is true regarding the program above

  The program is reading from a temporary data set and writing to a temporary data set.                       

  The program is reading from a temporary data set and writing to a permanent data set.                       

  The program is reading from a permanent data set and writing to a temporary data set.                       

  The program is reading from a permanent data set and writing to a permanent data set.                       

Question 6:- Which of the following is the pre-requisite of merge?

  sorted data                        

  sorted data by ID variable                       

  data with no missing values                          none of the above                       

Question 7:- How can you limit the variables written to output dataset in DATA STEP?

  DROP                       

  KEEP                       

  VAR                        

  Both A and B                       

Question 8:- Which of the following statements are used to read delimited raw data file and create an SAS data set?

  DATA and SET                       

  DATA, INFILE and INPUT                        

  DATA, SET and INFILE                       

  DATA, SET and INPUT                       

Question 9:- Which of the following command will find the number of missing marks in all variables of table “Class”

  proc means data=class N; run ;                          proc means data=class N NMISS ; run;                       

  proc means data=class SUM N;run;                       

  Both B and C                       

Question 10:- Which of the following command will help to impute the missing value of column “Hindi” with average marks of “Hindi”?

  Proc SQL; Create table temp as Select *, mean(Hindi) as avg_score from Class; quit; Data class; Set temp; If

Hindi=. Then Hindi_2=avg_score; Else Hindi_2=Hindi;run;                       

  Proc SQL; Create table temp as Select *, mean(Hindi) as avg_score from Class; quit; Data class; Set class; If

Hindi=. Then Hindi_2=avg_score; Else Hindi_2=Hindi;run;                       

  Both A and B                       

  None of the above                       

Question 11:- Categorical column may contain more than two distinct values. For example, “Married” has two values, “Yes” and “No”. How will you find all the distinct values present in the column “Education”?

  proc means data=Table5; var Education; run;                          proc freq data=Table5; tables Education; run                       

  Both A and B                       

  None of the above                       

Question 12:- Which of the following statement can be used to accumulate the value of the variable in a Data Step?

  SET                       

  SUM                       

  RETAIN                       

  UPDATE                       

Question 13:- Import the dataset “data_1”. Suppose the variable `Unit_Cost_Price` (numeric) contains both missing and non missing values. What would the following code return? 

proc sort data=data_1; by Unit_Cost_Price;

  A new dataset work.price list is created with Unit_Cost_Price sorted in ascending order with missing values at the bottom of the dataset                       

  The dataset data_1 is sorted with Unit_Cost_Price sorted in descending order with missing values at the bottom of the dataset                       

  A new dataset work.price_list is created with Unit_Cost_Price sorted in descending order with missing values at the top of the dataset                       

  The dataset data_1 is sorted with Unit_Cost_Price sorted in ascending order with missing values at the top of

the dataset                       

Question 14:- How to determine if there is a significant relationship between two categorical variables?

  PROC FREQ DATA = Hello; TABLE Gender*Valid_customer / NOPERCENT NOROW NOCOL CHISQ;

RUN;                       

  PROC FREQ DATA = Hello; TABLE Gender*Valid_customer / NOPERCENT NOROW NOCOL Ttest;

RUN;                       

  PROC FREQ DATA = Hello; TABLE Gender*Valid_customer / CHISQ; RUN;                       

  A and C                       

Question 15:- To find the effects of a medicine in a before-after fashion, the following code can be used:

  PROC TTEST DATA = medicine H0 = 50 sides=2 alpha=0.05; VAR med_before; Class med_after;

RUN;                       

  PROC TTEST DATA = medicine; PAIRED med_before * med_after; RUN;                       

  A and C                       

  None of the above                       

Question 16:- Which of the following programs contain a syntax error?   proc sort data=sasuser.mysales; by region;run;                       

  dat sasuser.mysales; set mydata.sales99;run;                       

  proc print data=sasuser.mysales label; label region=`Sales Region`;run;                          none of the above.                       

Question 17:- Which statement will limit a PROC MEANS analysis to the variables Boarded, Transfer, and Deplane?

  var boarded transfer deplane;                          class boarded transfer deplane;                       

  by boarded transfer deplane;                          output boarded transfer deplane;                       

Question 18:- Which of the clauses below correctly sorts rows by the values of the columns Price and SqFeet ?

  order price, sqfeet                          order by price,sqfeet                       

  sort by price sqfeet                       

  sort price sqfeet                       

Question 19:- noobs` option is consistent with

  proc sql                          proc ttest                        

  proc univariate                          proc print                       

Question 20:- The SAS data set EMPLOYEE_INFO is listed below:

IDNumber Expenses

2542 100.00

3612 133.15

2198 234.34

2198 111.12

The following SAS program is submitted: proc sort data = employee_info;

Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value?

  by Expenses IDNumber;                          by IDNumber Expenses;                       

  by ascending (IDNumber Expenses);                       

  by ascending IDNumber ascending Expenses                       

Case Study

In the data set ‘Fin_account’ in `myfolders` . Please solve the following questions :

Question 21:- Create a column ‘percentage’ using the variables :

Tot_New_Bal1012 and Credit_Lim1012. The answer should be a percentage value   libname test `/home/my_name/`; data acct1; set test.FIN_ACCOUNT; percentage=Tot_New_Bal1012/

Credit_Lim1012; run;                       

  libname test `/home/my_name/`; data acct1; set test.FIN_ACCOUNT; percentage=100*(Tot_New_Bal1012/

Credit_Lim1012); run;                       

c)         data acct1; set test.FIN_ACCOUNT; percentage=(Tot_New_Bal1012/ Credit_Lim1012); run;                       

d)         libname test `/home/my_name/`; data acct1; set FIN_ACCOUNT; percentage=(Tot_New_Bal1012/

Credit_Lim1012); run;                       

Question 22:- If this new percentage variable is missing or zero, then assign value 999 to it and create this as a new variable

a)            data acct2; set acct1; if percentage =. or percentage =0 then percentage1=999; elsepercentage1=percentage; run;                       

b)            data acct2; set acct1; if percentage =` ` or percentage =0 then percentage1=999; elsepercentage1=percentage; run;                       

c)            data acct2; set acct1; if percentage =. and percentage =0 then percentage1=999; elsepercentage1=percentage; run;                        

d)            data acct2; set acc5 if percentage =. or percentage =0 then percentage1=999; else percentage1=percentage;

run;                       

Question 23:- Write down how many observations have Credit_Lim1012 is missing or 0.

a)            proc freq data=acct2; table percentage/nopercent nocol nocum norow ; run;                       

b)            proc freq data=acct2; table percentage/nopercent nocol nocum norow missing; run;                        

c)            proc freq data=acct2; table percentage/missing; run;                        d)            Both B and C                       

Question 24:- Create a new sas table ‘normal_fin_acc’ only containing the records with the restricted condition ‘0=

a)            data normal_fin_acc; set acct2; where percentage >= 0 and percentage <= 100; run;                       

b)            data normal_fin_acc1; set acct2; where 0<=percentage<=100; run;                        c)              Both A and B                       

d)      None of the above                       

Question 25:- Elaborate some statistical results like, mean median, variance, range, min max etc by product_code of Purchase_Amt

a)            PROC MEANS DATA = test.FIN_ACCOUNT ; CLASS Product_Code; VAR Purchases; RUN;                       

b)            PROC MEANS DATA = test.FIN_ACCOUNT N NMISS SUM MEAN VAR STD MIN MAX RANGE Q1 Q3 MEDIANSKEW KURT CV STDERR; CLASS Product_Code; VAR Purchases; RUN;                        c)           Both A and B                       

d)      PROC MEANS DATA = test.FIN_ACCOUNT ; CLASS Purchases; VAR Product_Code RUN;                       

hihi


Want latest solution of this assignment

Want to order fresh copy of the Sample Template Answers? online or do you need the old solutions for Sample Template, contact our customer support or talk to us to get the answers of it.