BookmarkSubscribeRSS Feed
urban58
Quartz | Level 8

Hello SAS community,

 

I have a dataset with a variable number_images with values 1 or 2 which indicate whether an image was read for a bunch of variable (n=110) at T0 or/and T2

this is what I get from proc freq
number_images nmissT0 nmissT2
1 0 110
1 1 110
1 2 110
1 3 110
1 4 110
1 5 110
1 6 110
1 7 110
1 8 110
1 9 110
1 10 110
1 12 110
1 14 110
1 15 110
1 18 110
1 31 110
1 93 110
1 110 0
1 110 1
1 110 2
1 110 6
1 110 10
1 110 12
1 110 13
1 110 14
2 0 0

If number_images=1, the image could have been read at either of the timepoints.
I want to keep number_images =1 but be able to distinguish those with readings at T1 or T2 only


if nmissT0=110 then the images was only read at T2
if nmissT2=110 then the images was only read at T0
if nmiss is <110, then the image was read at least for some features at one timepoint- not concerned with that part for this question

 

I would like to update number_images to have something like this but I know this won't work
proc format;
value n_imagf
1="1: V0 readings only"
1="1: V2 readings only"
2="2: V0, V2 readings"

What can I do instead so number of images still shows 1 and is numeric?
if number_images=1 and nmissT0=110 then number_images=1??

 

Can anyone help?

Thanks,
Maggie

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

If I am understanding everything properly, you need to create a new variable that indicates "1: V0 readings only" or "1: V2 readings only" or "2: V0, V2 readings", and then format that new variable.

--
Paige Miller
urban58
Quartz | Level 8

yes, please Paige Miller

PaigeMiller
Diamond | Level 26

if nmissT0=110 then the images was only read at T2
if nmissT2=110 then the images was only read at T0
if nmiss is <110, then the image was read at least for some features at one timepoint- not concerned with that part for this question

 

if nmissT0=110 then category=1;
else if nmissT2=110 then category=2;
else category=3;

 

and then

 

proc format;
     value catf 1='V0 readings only' ... 
    ;
run;

 

 

--
Paige Miller
ballardw
Super User

Can you provide an example of your data in a data step and what you want from that example.

 

I am afraid that the output you show doesn't look at all like any normal Proc Freq output (it doesn't normally have any NMISS) so I can't interpret what that might be.

Or at least show the proc freq code that supposedly generated it.

 

I strongly suspect this is going to take an example of the data and some manipulation PRIOR to proc freq to accomplish.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 2338 views
  • 0 likes
  • 3 in conversation