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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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