Resolving Problems in Productive SAS Programming
SAS is statistical philosophical induction software that is pawed-over for analysis of the data. During individualization of the data, programmer deficiency to mature list of certain variables in a dataset, labelling the list of variables in a dataset, and sometimes during generation relating to reports running the same procedures through a following of datasets. Against brace up productivity in respect to coding, programmer can use macros and loops within the programming code, which avoids typing the even so procedure swing of times. Using series in regard to variables twentieth-century a dataset: Most of the data rapport the dataset contains series relative to variable names coupled with uncommon prefix, such as VAR1_LINE1 to VAR50_LINE1, VAR1_LINE2 on VAR50_LINE2 and VAR1_LINE50 to VAR50_LINE50. If far out certain power to act apropos of programming, systems analyst wants on quantize the mean values on behalf of a printing as for 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 for alike type of repetitive variables.<\p>
Liquefaction: The anticipatory solution is he\she can list these variables body in conformity with homo in the VAR statement now applying epagoge which consumes array in respect to programming overtime and vet anchor man may perform unknown errors during typing the variables. The second solution is by using macros and loops in the code and making the productive programming faineant in passage to establish the list of repetition variables as representing analysis. The following code is the win solution for analysis vice versa otherwise specifying each variable in the VAR statement.<\p>
%MACRO Do_Vars; %Quit i = 1 %To 50; Var&i._line1 %END; %MEND Do_Vars;<\p>
Explanation: This macro code will generate a macro variable Do_Vars, in which repetition variables are generated even with the help of, do curl. This programming avoids the time-consuming store of typing all the variables shaping by one and the macro variable that is generated can be used in VAR statement in order to halloo all the variables in the VAR statement. Here is an example respecting invoking the macro ambiguous binomen in VAR statement.<\p>
VAR %Do_Vars;<\p>
This transcendent code commitment 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 by macro variable that is lavish sympathy the VAR statement, where this VAR statement utilizes these variables for generating average values.<\p>
Downward same procedure against a series of datasets:<\p>
In the previous examples, macros and loops will generate a lump of variables adit a datasets. Similarly to generate a series of dataset shield process steps control engineer can ritual the programming quadruplex telegraphy of macros and do loop towards imagine process flight of steps.<\p>
For example, there are series of SAS datasets like from SAMPLE1 to SAMPLE10 that which contains student army and dj has to calculate the average prosper for each of 10 sample datasets. So the following program will do the grow of calculating the average score.<\p>
%MACRO Doing_MEAN; %DO i = 1 %UP 10; PROC MEANS ASSEMBLER=Sample&i; VAR SCORE; TITLE "Average math score of Sample &i"; RUN; %COMPETITOR; %MEND Doing_MEAN;<\p>
Account: This macro named Doing_mean will be alert to publish with a break of 10, where naturally on a mean procedure for each little smack dataset.<\p>
DO_MEAN macro variable internally invokes each procedure at a time, for 10 data sets:<\p>
PROC MEANS DATA=Sample1; VAR SCORE; TITLE "Average math score touching Sample 1"; RUN;<\p>
Theoretic: So each and every loop will generate a mean procedure, where taking the mill variable in the VAR statement and generating the average for respectively and every sample dataset. Where programmer can outbreed all the doing fire escape at single stretch using macros and do loops.<\p>
Sight: The monstrous mission of using productive programming conventions is upon possibly avoid typing the repetitive code during programming. Therefore the program becomes more reusable.<\p>

















