Value $age (multilabel notsorted)
LOW - HIGH = "Persons of all ages"
'000'-'004' = "Pre-school children (0-4 years)"
'005'-'012' = "Primary school children (5-12 years)"
'013'-'018' = "Teenagers (13-18 years)"
'019'-'024' = "Young adults (19-24 years)"
'025'-'034' = "Persons ages 25-34 years"
'035'-'044' = "Persons ages 35-44 years"
'045'-'054' = "Persons ages 45-54 years"
'055'-'064' = "Persons ages 55-64 years"
'065'-'074' = "Persons ages 65-74 years"
'075'-high = "Persons ages 75 years and over"
mean (of low-high) = "Average" ;
Bold is where the mistake lies.
Very new to SAS and couldn't figure it out and it was just a guess idea from reading things online. Why won't this work?
And if possible how to I fix it?
As far as I am awre you can't put aggregate functions in a format step. If you want to get means, then look at proc means:
proc means data=have;
var age;
output out=want mean=mean;
run;
A second issue: your format indicates the age variable is text. Means of text aren't going to calculate unless you convert them to numeric. For your format manually calculate it. I wouldn't expect to see that unless you are planning on using a procedure that uses preloadfmt.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: