BookmarkSubscribeRSS Feed
pmpradhan
Quartz | Level 8

 

 

My data looks like

 

X     pct_Elderly     

1      1.1

0       2.0

1       3.0

0       4.8

1        9.5

0       0.9

0       3.3

1       70.6

1      19.8

 

I need to populate a table like:  

                                  X
Total  5
high elderly(+1 SD)  ?

 

All suggestions welcomed!

5 REPLIES 5
PaigeMiller
Diamond | Level 26

PROC MEANS

--
Paige Miller
Reeza
Super User
What are the rules? What exactly are you having trouble with? Your last question had an example of PROC MEANS and getting output, does that not work here as well for some reason?


pmpradhan
Quartz | Level 8

I was thinking whether it is :

 

Procedure 1:

proc means data=have;

var pct_elderly;

where x=1;

run;

 

or 

Procedure 2:

data want;

set have;

high_elderly=(pct_elderly>=means+sd);

run;

 

proc freq data=want;

tables high_elderly;

where x=1;

run;

Reeza
Super User

Those are very different. Based on the data you presented, what number are you expecting? What are the business rules?

 

For the second approach, I don't see the mean/sd so not sure where you're expecting that to come from and I wouldn't expect that to work. Does it work, or return errors?

 

 

PaigeMiller
Diamond | Level 26

@pmpradhan wrote:

I was thinking whether it is :

 

Procedure 1:

proc means data=have;

var pct_elderly;

where x=1;

run;

 

or 

Procedure 2:

data want;

set have;

high_elderly=(pct_elderly>=means+sd);

run;

 

proc freq data=want;

tables high_elderly;

where x=1;

run;


Did you even try these? Do they produce the answer you want? If not, state clearly what is missing from these answers.

 

Specifically, what is wrong with your Procedure 1? It seems like it does what you are asking (although I'm not 100% clear on what you are asking)

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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