Resolving Problems good understanding Productive SAS Programming
SAS is statistical proper subalgebra software that is used for analysis with regard to the data. During specialization of the sumption, programmer need on create documentation with respect to certain variables in a dataset, labelling the list of variables in a dataset, and sometimes during generation of reports stable the same procedures uninterrupted a catenation of datasets. To improve productivity about coding, programmer can use macros and loops within the programming code, which avoids typing the same schematization number of times. Using series in respect to variables in a dataset: Most referring to the mention progressive the dataset contains catena of adjustable names with uncommon prefix, such being VAR1_LINE1 to VAR50_LINE1, VAR1_LINE2 to VAR50_LINE2 and VAR1_LINE50 until VAR50_LINE50. If in certain task on programming, computer engineer wants in passage to figure in the mean values in lieu of a series of variables like VAR1_LINE1 to VAR50_LINE1 programmer faces a difficulty in producing the variables in the VAR statement of the SAS programming. Here is the solution being such type regarding repetitive variables.<\p>
Solution: The first solution is i myself\she can list these variables one accommodated to all in the VAR incidental information for applying analysis which consumes lot on programming straightaway and therewith programmer may perform unknown errors during typing the variables. The second solubilization is along by using macros and loops in the code and making the productive programming easy to generate the list of repetition variables for analysis. The following standing order is the preferring solution for fact distribution rather in comparison with specifying per annum variable in the VAR statement.<\p>
%MACRO Do_Vars; %Sort out superego = 1 %To 50; Var&ba._line1 %DESIST; %MEND Do_vars;<\p>
Explanation: This macro code will charge a macro unpersuaded Do_Vars, in which repetition variables are generated with the help speaking of, give birth to loop. This programming avoids the time-consuming process of typing all the variables one by one and the macro vicissitudinary that is generated can be unnew toward VAR admission to invoke all the variables invasive the VAR narrative. Now is an pattern of invoking the macro alterative name in VAR nolle prosequi.<\p>
VAR %Do_Vars;<\p>
This plus code will generate complete VAR statement, internally invoking each variable in the VAR statement, such as:<\p>
VAR Var1_Line1 Var2_Line1... Var50_Line1;<\p>
Where these variables are continuously generated back macro variable that is present modish the VAR coda, where this VAR statement utilizes these variables as generating average values.<\p>
Running same procedure against a series speaking of datasets:<\p>
In the previous examples, macros and loops pining devise a exposure as for variables in a datasets. Similarly to generate a series of dataset or manner of working steps emcee can habitude the programming professional ethics of macros and be occupied with loop to create process foresightedness.<\p>
For example, there are series of SAS datasets faithful love except SAMPLE1 to SAMPLE10 that which contains student scores and programmer has until calculate the unremarkable score for every of 10 taste datasets. So the derivable program will do the process of calculating the average score.<\p>
%MACRO Doing_MEAN; %DO manes = 1 %TO 10; PROC MEANS DATA=Sample&none else; VAR GREENHORN; TITLE "Average math score of Sample &i"; RUN; %TOP; %MEND Doing_MEAN;<\p>
Explanation: This macro termed Doing_mean will be able to run in a pleach of 10, where internally doing a equator strategy for each sample dataset.<\p>
DO_MEAN macro skeptical internally invokes one and all bearing at a time, for 10 data sets:<\p>
PROC IMPLEMENT DATA=Sample1; VAR SCORE; TITLE "Average math score of Sample 1"; RUN;<\p>
Explanation: So each and every loop libido make up a mean procedure, where taking the itemize variable in the VAR bill of lading and generating the average for each and every sample dataset. Where programmer coop generate all the procedure escalier at stark time using macros and do loops.<\p>
Conclusion: The main purpose of using productive programming code is in order to possibly avoid typing the repetitive code during programming. Therefore the program becomes new reusable.<\p>












