Observations and variable not reading in

Reply
Learner
Posts: 1

Observations and variable not reading in

can someone tell me why this is not working. 

 

libname th 'E:\ThesisFolder';

 

*importing  case list;

 

proc import

datafile='E:\ThesisFolder\DataforSAS\Case_List.xls'

dbms=xls

out=Case_list

replace;

run;

 

proc contents data=Case_list; run; *180 obs and 69 variables;

proc print data=Case_list;run;

 

*creating age variable with 3 categors;

 

data cases; set th.Case_list;

if 0 le AgeYr le 4 then nagegrp='1(0-4)';              

else if 5 le AgeYr le 17 then nagegrp='2(5-17)';          

else if AgeYr>18 then nagegrp ='3(18+)';  

run;

 

proc contents data=cases;run;

 

proc print data=cases;run;

Super User
Posts: 11,343

Re: Observations and variable not reading in

Posted in reply to gilihrusa

We can't tell what "not working" may be.

Are you getting error messages? If so post the code and error from the log.

No output? Which step is generating no output.

Unexpected output? You'll need to provide examples of the input, the expected output and the actual output.

 

Also

if 0 le AgeYr le 4 then nagegrp='1(0-4)';              
else if 5 le AgeYr le 17 then nagegrp='2(5-17)';          
else if AgeYr>18 then nagegrp ='3(18+)';  
run;

Does not assign a group for age exactly equalt to 18. You likely want

 

else if AgeYr ge 18 then nagegrp ='3(18+)'; 

Ask a Question
Discussion stats
  • 1 reply
  • 208 views
  • 0 likes
  • 2 in conversation