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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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