<< Yellow Readme File >> 1. First, copy and paste the all lines of code that are using either a macro variable or functions. (Hint: there are three) (three of four) where cntyname in (&CNTY); array dc{*} %concatQ(dc, 20101, 20124); where dc20112> &avg20112; title "The mean for 2011QTR2 was &avg20112"; 2. For each line, how is the line of code resolved? Type in the regular SAS program that is generated by the macro used. where cntyname in (&CNTY); > where cntyname in ('Bexar', 'Dallas', 'Travis', 'Harris'); array dc{*} %concatQ(dc, 20101, 20124); > array dc{*} dc20101 dc20102 dc20103 dc20104 dc20111 dc20112 dc20113 dc20114 dc20121 dc20122 dc20123 dc20124; where dc20112> &avg20112; > where dc20112> 1677.923913; title "The mean for 2011QTR2 was &avg20112"; > title "The mean for 2011QTR2 was 1677.923913"; 3. First, copy and paste the one line using %concatQ > array dc{*} %concatQ(dc, 20101, 20124); 4. How is this line of code resolved? That is, type in the regular SAS program that is generated by the macro used. > array dc{*} dc20101 dc20102 dc20103 dc20104 dc20111 dc20112 dc20113 dc20114 dc20121 dc20122 dc20123 dc20124; 5. Now change %concatQ with.%concatI. How is this line of code resolved? %concatI(dc, 20101, 20124, 2). > array dc{*} dc20101 dc20103 dc20105 dc20107 dc20109 dc20111 dc20113 dc20115 dc20117 dc20119 dc20121 dc20123 6. What if %concatM was used instead? How is this line of code resolved? %concatM(dc, 201001, 201204) > array dc{*} dc201001 dc201002 dc201003 dc201004 dc201005 dc201006 dc201007 dc201008 dc201009 dc201010 dc201011 dc201012 dc201101 dc201102 dc201103 dc201104 dc201105 dc201106 dc201107 dc201108 dc201109 dc201110 dc201111 dc201112 dc201201 dc201202 dc201203 dc201204 7. What if %concatMC was used instead? How is this line of code resolved? %concatMC(dc, 201001, 201204) > array dc{*} dcjan10 dcfeb10 dcmar10 dcapr10 dcmay10 dcjun10 dcjul10 dcaug10 dcsep10 dcoct10 dcnov10 dcdec10 dcjan11 dcfeb11 dcmar11 dcapr11 dcmay11 dcjun11 dcjul11 dcaug11 dcsep11 dcoct11 dcnov11 dcdec11 dcjan12 dcfeb12 dcmar12 dcapr12 8. In the readme file: Explain succinctly in plain English what each of the %concatX macro functions does. > %concatX macro functions build a string of variable names for specified start and end values with appropriate tags. 9. Copy and paste the regular SAS code you wrote to label the 12 variables > label dc20101 = 'Inpatient Discharge in 20101' dc20102 = 'Inpatient Discharge in 20102' dc20103 = 'Inpatient Discharge in 20103' dc20104 = 'Inpatient Discharge in 20104' dc20111 = 'Inpatient Discharge in 20111' dc20112 = 'Inpatient Discharge in 20112' dc20113 = 'Inpatient Discharge in 20113' dc20114 = 'Inpatient Discharge in 20114' dc20121 = 'Inpatient Discharge in 20121' dc20122 = 'Inpatient Discharge in 20122' dc20123 = 'Inpatient Discharge in 20123' dc20124 = 'Inpatient Discharge in 20124' ; (The second set of answers will be different for everyone, since it is dependent on the counties selected); 10. What is the average number of patients discharged over all hospitals in 2011 quarter 2? > 1677.923913 11. How many hospitals discharged more than the average number of patients discharged in 2011 quarter 2? > 57 hospitals 12. Which counties are this hospitals located in? > Bexar, Dallas, Harris, Travis Hospital County Cumulative Cumulative cntyname Frequency Percent Frequency Percent ------------------------------------------------------------------------------ Bexar 14 24.56 14 24.56 Dallas 11 19.30 25 43.86 Harris 26 45.61 51 89.47 Travis 6 10.53 57 100.00 ----------------------------------------------------------------------------------------------- << in Blue, what is changed in the code explained. See sas code posted as well>> 9. In the program: Find three places where you can use the macro %concatQ, and edit the code to use it. That is, delete the regular SAS code, and replace it with code that uses the macro * three places where you should modify code to use concatQ - DOES NOT COUNT because in original code: array dc{*} %concatQ(dc, 20101, 20124); * (inside proc summary, once) proc summary; var %concatQ(dc, 20101, 20124); output out=stats; *(inside proc freq, twice) proc freq data=data.myipstatw; format %concatQ(dc, 20101, 20124) miss.; tables %concatQ(dc, 20101, 20124); --------- In main program & config file. what works options 2 (Better given the instructions). Two macro definitions are given. 11. writing %labelQ macro function * Option 2.1 definition; %macro labelQ2(file, start, end, tag); %concatQ(file=&file, start=&start, end=&end, tag=&tag) %mend; * Option 2.2 definition; %macro labelQ(file, start, end, tag); %* start and end have the format YYQ; %do i = &start %to &end; %let Y=%eval(&i/10); %let Q=%eval(&i-&Y*10); %if ((0<&Q) and (&Q<5)) %then %do; &file&i = "&tag &i" %end; %else %let i=%eval(&Y+1)0; %end; %mend; * inside main code; label hid = 'Texas Health Care Information Colslection ID' hcity = 'Hospital City' cntyname = 'Hospital County' %labelQ(dc, 20101, 20124, Inpatient Discharge in ); * HOW TO USE the more complicated labelQ2 macro; *%labelQ2(dc, 20101, 20124, %str(="Inpatient Discharge in &i")) ; ------------------------------------------------------------------------------------------------ 12. Edit the program to use a different set of counties. Make sure to use the macro variable CNTY. %let cnty='Brazos', 'Collin', 'Tarrant', 'Victoria';