BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HyunJee
Fluorite | Level 6

I have data with immunization for individuals. I am needing to create a new line for each individual by each new date that appears, but at the same time have a list of the immunizations for that occured on each date listed.

I have been trying to make this work for some time, but it has been a bit of a disaster and I cannot seem to figure this out. Any help is appreciated.

I want my data to go from looking like this:

ID          Date              Vaccine

1b          06/06/08     vac123

1b          06/06/08     vac345

1b          06/06/08     vac678

1b          06/06/08     vac910

1b          07/09/10     vac123

1b          07/09/10     vac345

1b          08/08/11     vac345

1b          08/08/11     vac678    

1b          08/08/11     vac910

to look like this:

ID     Date               vac123          vac345          vac678          vac910

1b     06/06/08          1                       1                   1               1         

1b     07/09/10          1                       1

1b     08/08/11                                   1                   1               1

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Add a 1 in to the dataset for each row and then use proc transpose.

data want1;

     set have;

     value=1;

run;

proc transpose data=want1 out=want2;

by id date;

var value;

id vaccine;

run;

View solution in original post

2 REPLIES 2
Reeza
Super User

Add a 1 in to the dataset for each row and then use proc transpose.

data want1;

     set have;

     value=1;

run;

proc transpose data=want1 out=want2;

by id date;

var value;

id vaccine;

run;

HyunJee
Fluorite | Level 6

This worked perfectly. Thank you!

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
  • 2 replies
  • 659 views
  • 0 likes
  • 2 in conversation