BookmarkSubscribeRSS Feed
deleted_user
Not applicable
hi ,
I have a dataset in format below:
ID Vi PRocedure
1 1 ABC
1 1 DEF
1 1 FCG
1 2 FCG
1 2 KKR

when I transpose this using proc transpose prefix=proc; by id vi;var procedure;run;

I get

ID Vi Proc1 Proc2 Proc3
1 1 ABC DEF FCG
1 2 FCG KKR .

actually what I need is something like this..

ID Vi ABC DEF FCG KKR
1 1 yes yes yes no
1 2 no no yes yes

I'm not sure how to get to here in my final dataset..

Appreciate for you help.

Eddie
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Assign a numeric variable to 1 for each observation, which you will use with transposing your data. Also, use the ID statement specifying your PROCEDURE variable to take the column/variable name.

Then use a PROC FORMAT to assign 1=YES and OTHER=NO for the numeric variable, applied with a FORMAT statement.


Scott Barry
SBBWorks, Inc.

SAS Procedures Guide: The TRANSPOSE Procedure
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000063661.htm
deleted_user
Not applicable
Hy Scott,
Great..this is working. Actually I was trying out using 2 D( visits * Procedure) arrays and almost lost few hair.. this approach was very simple..

Appreciate your quick help...

Thanks.


Addy

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 2 replies
  • 876 views
  • 0 likes
  • 2 in conversation