BookmarkSubscribeRSS Feed
RShaw
Calcite | Level 5

Helllo! I am a research student that is working with survey data to examine the co-occurrence of itch with other co-morbidities. Basically, I am looking at whether or not itch presents with other comorbidities such as PulmonaryCardiac pre- and post-survey. The following code, for example, I think, was used to delineate that: 

 

if(Pre_PulmonaryCardiac = 0 & Post_PulmonaryCardiac = 1) then PulmonaryCardiac = 1;
else if(Pre_PulmonaryCardiac = 1 & Post_PulmonaryCardiac = 0) then PulmonaryCardiac = 2;
else if(Pre_PulmonaryCardiac = 1 & Post_PulmonaryCardiac = 1) then PulmonaryCardiac = 3;
else PulmonaryCardiac = 0; 

 

I'm now trying to create a combined frequency table of results to examine whether itch presented with PulmonaryCardiac regardless of whether its pre- or post-survey. In other words, I want to develop a format that combines any patients that have any instance of a particular variable and set that to 1, if no then 0.

 

The code I am currently utilizing does not give me the right combined results: 

 

proc freq data = ITCH.CROSS_MERGED1;
where PulmonaryCardiac = 0 | PulmonaryCardiac = 2;
tables rMSA_Q_12 * PulmonaryCardiac / chisq;
format PulmonaryCardiac FORMAT_FOR_COMPOSITES. rMSA_Q_12 rMSA_2bin.;

 

Wrong Combines Results.png

 

How should I format a code that would allow me to get frequencies for: (1) no Dx pre and post (2) Dx pre, post, whereever?

 

2 REPLIES 2
Reeza
Super User
Can you post an example of what your input data looks like and what you would expect as output.
s_lassen
Meteorite | Level 14

Not sure if that's what you want, but a format to divide the data into any/no pulmonary condition can be written like this:

proc format;
  value anyPulmonary
    0='No pulmonary condition'
    1,2,3='Pulmonary condition'
    ;
run;

You can than apply that format to your PulmonaryCardiac variable.

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
  • 2 replies
  • 791 views
  • 2 likes
  • 3 in conversation