Question: Stat 6 6 0 5 : SAS Programming Final Exam Due Date: 0 4 / 3 0 / 2 0 2 4 Please Note: 1
Stat : SAS Programming
Final Exam
Due Date:
Please Note:
Write your name in your program using a comment statement.
Assign a title with the problem number for each problem,
Your output for each problem should contain only what is asked.
Please submit your programs and outputs.
Problems:
Given the set of numbers: using the array to find averages of any two numbers from a set of numbers. The two numbers can be the same.
Given the data set, using array to change all zeros to missing.
data dd;
input x name $ address $ mm cc di $ kk;
cards;
aa klkk
bb lkj
ddd and
;
Run;
What, if anything, is wrong with the following programs? An ellipsis indicates proportions of a statement that are not germane to the exercise.
a data p; set mast;
if sector a then output;
data p; set me;
if sector then output;
data sects;
merge p p;
by sector;
b data one; infile ;
length type ;
input lab grp mm;
run;
data two; infile ;
input lab grp type mxmx;
run;
data merge;
merge two one;
by lab grp;
run;
What, if anything, is wrong with the following programs?
a data new; update one two three; by id;
b data new; update transact master; by id;
Refer to the data
data demog;
input id contry $ pop pcturb energy cult
pasture forest ;
cards;
China
Japan
Philippines
India
Vietnam
Bangladesh
Indonesia
Paskistan
United States
Mexico
Brazil
Nigeria
USSR
West Germany
Italy
;
run;
and format:
proc format;
value cont 'Asia' 'Australasia'
N America' S America'
'Africa' 'Europe';
Run;
a Write chart procedure statements to produce a vertical bar chart of average energy consumption by country grouped into continent. Use the cont format to recode country number into continent name. What would the chart look like if the format were not used?
b How would you rewrite the cont format to arrange the bars in alphabetical order? You could accomplish this by using a chart statement.
What, if anything, is wrong with the following assignment statements?
a xtfebd;
b baselinedapr;
c stmar;
Variable zipcode is read with format$ It reads zip codes in the form or Create variabledigit. It equals if zipcode has a hyphen separating the fifth and seven digits. Otherwise it equals Write the statements three ways, using the length, index, and substr functions.
Variable name fullname length $ has a respondents first, middle, and last name. Create var shortname length $ which has only the first and last name, separated by a single blank.
Count the number of times the string occurs in variable line. Choose any method that works reliably. Regardless of method, assume that a line wont consist entirely of s
A SAS dataset has the following values for its numeric variables:
Do not know
Refused to answer
Skipped question
Write the data step statement to convert these values to the standard sas missing value
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
