BookmarkSubscribeRSS Feed
MSALKAR
Calcite | Level 5

This is my code 

/*fairlie decomposition 2011-2012*/
libname MONIKA "C:\Users\msalkar\Desktop\THESIS-MONIKA";
options obs=max;
options nolabel ls=75 ps=140;
%let numiterations=100;
%let r=2;
%let gendervars=male female;
%let k=12;

%let definegroup1 = MM1W MM2W MM3W;
%let definegroup2 = mahila_mandal VI20;
%let definegroup3 = religion caste;
%let definegroup4 = BHED INCOME occupation;
%let definegroup5 = MOTHERS_EDUCATION FHEADAGE;

%let definegroup6 = RO6  LB18;


%let labelgroup1="media_exposure";
%let labelgroup2="social_events";
%let labelgroup3="cultural_influences";
%let labelgroup4="household_factors";
%let labelgroup5="mothers_age/education";

%let labelgroup6 = "TBA";


%let mdefinegroup1 = mMM1W mMM2W mMM3W;
%let mdefinegroup2 = mmahila_mandal mVI20;
%let mdefinegroup3 = mreligion mcaste;
%let mdefinegroup4 = mBHED mINCOME moccupation;
%let mdefinegroup5 = mMOTHERS_EDUCATION mFHEADAGE;

%let mdefinegroup6 = mRO6  mLB18;


%let wdefinegroup1 = wMM1W wMM2W wMM3W;
%let wdefinegroup2 = wmahila_mandal wVI20;
%let wdefinegroup3 = wreligion wcaste;
%let wdefinegroup4 = wBHED wINCOME woccupation;
%let wdefinegroup5 = wMOTHERS_EDUCATION wFHEADAGE;

%let wdefinegroup6 = wRO6  wLB18;


%let vars= &definegroup1 &definegroup2 &definegroup3 &definegroup4 &definegroup5  &definegroup6;
%let mvars= &mdefinegroup1 &mdefinegroup2 &mdefinegroup3 &mdefinegroup4 &mdefinegroup5  &mdefinegroup6;
%let wvars= &wdefinegroup1 &wdefinegroup2 &wdefinegroup3 &wdefinegroup4 &wdefinegroup5  &wdefinegroup6;

 

 

data monika.merge2012;
set monika.merge2011;
mergeobs=1;
y=child_immunization;
if y=. or MM1W=. or MM2W=. or MM3W=. or INCOME=. or FHEADAGE=. or VI20=. or mahila_mandal=. or
religion=. or caste=. or occupation=. or mothers_education=. then delete;
if wt=. or wt<=0 then delete;
run;

data monika.regdata;
set monika.merge2012;
if male=1 or female=1; run;

data monika.male (keep=ym wtm &mvars mergeobs);
set monika.merge2012 ;
array varsa(&k) &vars;
array mvarsa(&k) &mvars;
ym=y;
wtm=wt;
do i=1 to &k;
mvarsa(i)=varsa(i);
end;
if male=1 then output; run;


data monika.female (keep=yw wtw &wvars mergeobs);
set monika.merge2012;
array varsa(&k) &vars;
array wvarsa(&k) &wvars;
yw=y;
wtw=wt;
do i=1 to &k;
wvarsa(i)=varsa(i);
end;
if female=1 then output; run;

 

 

After running this I do not get an error but in the data set the values of the variables RO6 and LB18 are not seen. Also, in my log window I do not see any errors but I am not get the any output. So i am not sure if my cide is working. I would appreciate your help. Below is the dataset;

xxx.png

5 REPLIES 5
Reeza
Super User

 

K is 12. How many variables does your array have?

 

MSALKAR
Calcite | Level 5
In my actual code i have put K=14, but yet it is not working.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Kurt_Bremser
Super User

The variables are not in &mvars, and so are not in the keep list. I guess you mean mRO6 and mLB18.

To recreate your results, we need some example data from merge2011. Please post it in a data step with datalines.

MSALKAR
Calcite | Level 5

This is how my dataset merge2011 looks with the two variables. I did not much follow as to how I include the variables RO6 and LB18 in my &mvars.Let me know.

 

xx11.png

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1547 views
  • 0 likes
  • 3 in conversation