Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.
%macro MACRO1;
data _null_;
set $indata1 $indata2;
length dsin $16. dsout $17.;
dsin='outdata.&outdata1;
dsout='outdata.&outdata2;
call symput("inset",dsin);
call symput("outset",dsout);
call execute('%MACRO2(&inset, &outset)');
run;
%mend MACRO1;
%macro MACRO2(dsin, dsout);
data var5data;
set &dsin;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
end;
else if car1 =
car1a then do;
Var5 = '4';
end;
else do;
Var5 = '5';
end;
output var5data;
run;
data counts (keep= Var1 Var2 Var3 Va4 Var5 Var6 Var7);
length count1 count3 count4 count5 count_in count_out;
retain count1 count3 count4 count5 count_in count_out;
count_in = count_in +1;
set var5data end=lastrec;
if Var5 = '1' then count1+1;
else if Var5 = '3' then count3+1;
else if Var5 = '4' then count4+1;
else if Var5 = '5' then count5+1;
count_in= count_out+1;
output;
end;
if lastrec then
do;
file process.log mod;
put 'Assign Var5 value for &type';
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
/* create the permanent dataset */
data &dsout;
set counts;
run;
%mend MACRO2;
/* Below macro calls the above macros according to value of TYPE */
%macro MAINMACRO;
/* Run Program for TYPE */
%if "&type" = "typea " %then %do;
%MACRO2("&indata1", "&outdata1", "&typea");
%end;
%else %if "&type" = "typeb " %then %do;
%MACRO2("&indata2", "&outdata2", "&typeb");
%end;
%mend MAINMACRO;
%MAINMACRO;
%let typea=%sysget(type);
/*Get needed parameters from script */
%macro getparamtrs;
data _null_;
length type $4;
type="&typea ";
call symput ("type", type);
run;
%mend getparamtrs;
%macro MACRO1(indata1, outdata1, typea);
data var5data;
set "&indata1";
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
end;
else if car1 =
car1a then do;
Var5 = '4';
end;
else do;
Var5 = '5';
end;
output var5data;
run;
data counts (keep= Var1 Var2 Var3 Va4 Var5 Var6 Var7);
length count1 count3 count4 count5 count_in count_out;
retain count1 count3 count4 count5 count_in count_out;
count_in = count_in +1;
set var5data end=lastrec;
if Var5 = '1' then count1+1;
else if Var5 = '3' then count3+1;
else if Var5 = '4' then count4+1;
else if Var5 = '5' then count5+1;
count_in= count_out+1;
output;
end;
if lastrec then
do;
file process.log mod;
put 'Assign Var5 value for &type';
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
/* create the permanent dataset */
data &outdata1;
set counts;
run;
%mend MACRO1;
%macro MACRO2(indata2, outdata2, typeb);
data var5data;
set "&indata2";
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
end;
else if car1 =
car1a then do;
Var5 = '4';
end;
else do;
Var5 = '5';
end;
output var5data;
run;
data counts (keep= Var1 Var2 Var3 Va4 Var5 Var6 Var7);
length count1 count3 count4 count5 count_in count_out;
retain count1 count3 count4 count5 count_in count_out;
count_in = count_in +1;
set var5data end=lastrec;
if Var5 = '1' then count1+1;
else if Var5 = '3' then count3+1;
else if Var5 = '4' then count4+1;
else if Var5 = '5' then count5+1;
count_in= count_out+1;
output;
end;
if lastrec then
do;
file process.log mod;
put 'Assign Var5 value for &type';
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
/* create the permanent dataset */
data &outdata2;
set counts;
run;
%mend MACRO2;
/* Below macro calls the above macros according to value of TYPE */
%macro MAINMACRO;
%getparamtrs;
/* Run Program for TYPE */
%if "&type" = "typea " %then %do;
%let type = typea;
%MACRO1("&indata1", "&outdata1", "&typea");
%end;
%else %if "&type" = "typeb " %then %do;
%let type = typeb;
%MACRO2("&indata2", "&outdata2", "&typeb");
%end;
%mend MAINMACRO;
%MAINMACRO;
%macro MAINMACRO(indata, outdata, type);
data var5data;
set &indata;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
end;
else if car1 =
car1a then do;
Var5 = '4';
end;
else do;
Var5 = '5';
end;
output var5data;
run;
data counts (keep= Var1 Var2 Var3 Va4 Var5 Var6 Var7);
length count1 count3 count4 count5 count_in count_out;
retain count1 count3 count4 count5 count_in count_out;
count_in = count_in +1;
set var5data end=lastrec;
if Var5 = '1' then count1+1;
else if Var5 = '3' then count3+1;
else if Var5 = '4' then count4+1;
else if Var5 = '5' then count5+1;
count_in= count_out+1;
output;
end;
if lastrec then
do;
file process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
/* create the permanent dataset */
data &outdata;
set counts;
run;
%mend;
Note that I have removed quotation marks around indata1 (which I have changed it to indata to align with the macro parameters).%let type=%sysget(type);
%let indata=%sysget(indata);
%let outdata=%sysget(outdata);
%MAINMACRO(&indata, &outdata, &type);
%let type=%sysget(typea);
%let indata=%sysget(indata1);
%let outdata=%sysget(outdata1);
%MAINMACRO(&indata, &outdata, &type);
%let type=%sysget(typeb);
%let indata=%sysget(indata2);
%let outdata=%sysget(outdata2);
%MAINMACRO(&indata, &outdata, &type);
%let type=%sysget(typea);
%let indata=%sysget(indata1);
%let outdata=%sysget(outdata1);
%MAINMACRO(&indata, &outdata, &type);
%let type=%sysget(typeb);
%let indata=%sysget(indata2);
%let outdata=%sysget(outdata2);
%MAINMACRO(&indata, &outdata, &type);
%macro MAINMACRO(indata, outdata, type);
data var5data;
set &indata;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
end;
else if car1 =
car1a then do;
Var5 = '4';
end;
else do;
Var5 = '5';
end;
output var5data;
run;
data counts (keep= Var1 Var2 Var3 Va4 Var5 Var6 Var7);
length count1 count3 count4 count5 count_in count_out;
retain count1 count3 count4 count5 count_in count_out;
count_in = count_in +1;
set var5data end=lastrec;
if Var5 = '1' then count1+1;
else if Var5 = '3' then count3+1;
else if Var5 = '4' then count4+1;
else if Var5 = '5' then count5+1;
count_in= count_out+1;
output;
end;
if lastrec then
do;
file process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
/* create the permanent dataset */
data &outdata;
set counts;
run;
%mend;
%macro MAINMACRO(indata, outdata, type);
data &output;
set &indata end=lastrec;
<< DO YOUR COUNT_IN here >>
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
<< DO YOUR COUNT1 here >>
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
<< DO YOUR COUNT3 here >>
end;
else if car1 =
car1a then do;
Var5 = '4';
<< DO YOUR COUNT4 here >>
end;
else do;
Var5 = '5';
<< DO YOUR COUNT5 here >>
end;
<< DO YOUR COUNT_OUT here >>
if lastrec then
do;
file process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
%macro MAINMACRO(indata, outdata, type);
data &output;
set &indata end=lastrec;
if _N_ = 1 then count_in = 1;
else count_in = count_in + 1;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
if _N_ = 1 then count1 = 1;
else count1 = count1 + 1;
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
if _N_ = 1 then count3 = 1;
else count3 = count3 + 1;
end;
else if car1 =
car1a then do;
Var5 = '4';
if _N_ = 1 then count4 = 1;
else count4 = count4 + 1;
end;
else do;
Var5 = '5';
if _N_ = 1 then count5 = 1;
else count5 = count5 + 1;
end;
count_out = count_out + 1;
if lastrec then
do;
file process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
if _N_ = 1 then do;
count_in = 0;
count1 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
count_out = 0;
end;
This will initialize all variables to 0.%let type=%sysget(typea);
%let indata=%sysget(indata1);
%let outdata=%sysget(outdata1);
%MAINMACRO(&indata, &outdata, &type);
%let type=%sysget(typeb);
%let indata=%sysget(indata2);
%let outdata=%sysget(outdata2);
%MAINMACRO(&indata, &outdata, &type);
%macro MAINMACRO(indata, outdata, type);
data &output;
retain count1 count3 count4 count5 count_in count_out;
set &indata end=lastrec;
if _N_ = 1 then do;
count_in = 0;
count1 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
count_out = 0;
end;
count_in = count_in + 1;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
count1 = count1 + 1;
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
count3 = count3 + 1;
end;
else if car1 =
car1a then do;
Var5 = '4';
count4 = count4 + 1;
end;
else do;
Var5 = '5';
count5 = count5 + 1;
end;
count_out = count_out + 1;
if lastrec then
do;
file process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
%mend;
#!/bin/bash
export INDATA1=/maindir/mydir/myindata1.sas7bdat
export OUTDATA1=/maindir/mydir/myoutdata1.sas7bdat
export INDATA2=/maindir/mydir/myindata2.sas7bdat
export OUTDATA2=/maindir/mydir/myoutdata2.sas7bdat
export type="typea "
export type="typeb "
$sas mysascode.sas
%let type=%sysget(typea);
%let indata=%sysget(INDATA1);
%let outdata=%sysget(OUTDATA1);
%MAINMACRO("&indata", "&outdata", "&type");
%let type=%sysget(typeb);
%let indata=%sysget(INDATA2);
%let outdata=%sysget(OUTDATA2);
%MAINMACRO("&indata", "&outdata", "&type");
%macro MAINMACRO(indata, outdata, type);
data "&oudata";
retain count1 count3 count4 count5 count_in count_out;
set "&indata" end=lastrec;
if _N_ = 1 then do;
count_in = 0;
count1 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
count_out = 0;
end;
count_in = count_in + 1;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
count1 = count1 + 1;
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
count3 = count3 + 1;
end;
else if car1 =
car1a then do;
Var5 = '4';
count4 = count4 + 1;
end;
else do;
Var5 = '5';
count5 = count5 + 1;
end;
count_out = count_out + 1;
if lastrec then
do;
file dir.process.log mod;
put "Assign Var5 value for &type";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
%mend;
%MAINMACRO("&indata", "&outdata", "&type");
%macro MAINMACRO(ind, outd, tp);
data "&oud";
retain count1 count3 count4 count5 count_in count_out;
set "&ind" end=lastrec;
if _N_ = 1 then do;
count_in = 0;
count1 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
count_out = 0;
end;
count_in = count_in + 1;
if car1||car2||car3 =
car1a||car2a||car3a then do;
Var5 = '1';
count1 = count1 + 1;
end;
else if car1||car2 =
car1a||car2a then do;
Var5 = '3';
count3 = count3 + 1;
end;
else if car1 =
car1a then do;
Var5 = '4';
count4 = count4 + 1;
end;
else do;
Var5 = '5';
count5 = count5 + 1;
end;
count_out = count_out + 1;
if lastrec then
do;
file dir.process.log mod;
put 'Assign Var5 value for ' "&tp";
put 'Total number of records with Var5 = 1: ' count1;
put 'Total number of records with Var5 = 3: ' count3;
put 'Total number of records with Var5 = 4: ' count4;
put 'Total number of records with Var5 = 5: ' count5;
put 'Total number of records read in: ' count_in;
put 'Total number of records read out: ' count_out;
put '*****************************************************';
put ' ';
end;
run;
%mend;
%macro final;
%let type=%sysget(type1);
%if "&type" = "typea" %then %do;
%let indata=%sysget(INDATA1);
%let outdata=%sysget(OUTDATA1);
%MAINMACRO("&indata", "&outdata", "&type");
%end;
%let type=%sysget(type1);
%if "&type" = "typeb" %then %do;
%let indata=%sysget(INDATA2);
%let outdata=%sysget(OUTDATA2);
%MAINMACRO("&indata", "&outdata", "&type");
%end;
%mend;
%final;
%macro final;
%let type=%sysget(type1);
%let indata=%sysget(INDATA1);
%let outdata=%sysget(OUTDATA1);
%MAINMACRO("&indata", "&outdata", "&type");
%let type=%sysget(type1);
%let indata=%sysget(INDATA2);
%let outdata=%sysget(OUTDATA2);
%MAINMACRO("&indata", "&outdata", "&type");
%mend;
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
AWS RDS Backups? | 3 | 51 | |
Removing line numbers from left column in config file | 7 | 61 | |
jboss 7.1 start up error | 1 | 30 | |
How do uses indexes to maximize MySQL Searches | 14 | 55 |
Join the community of 500,000 technology professionals and ask your questions.