BookmarkSubscribeRSS Feed
vanpeltm1785
Obsidian | Level 7

Hello all,

 

I am wondering how I can transpose data based on one variable, then keep all of the additional variables, but without transposing them?

 

Thanks,

Matt

SAS Enterprise Guide 7.1

 

PROC TRANSPOSE DATA=WORK.NON_ENR_PROV_NPI_LIST OUT=PROV_TEST(DROP=_NAME_ _LABEL_);

BY MEMBER_ID;

VAR PRESCRIBER_NPI; 

/* Here are the columns I want to keep, but not transpose by
PROV_LAST_NAME 
PROV_FIRST_NAME 
prov_location_city 
prov_location_state 
prov_location_POSTAL_CODE*/

RUN;

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, could you provide an example, with datastep test data and required output.  Your post doesn't really make sense.  You mean you have a dataset where you want to pull out some variables, transpose them and then merge back onto your original data?  If so:

proc sort data=have out=inter (keep=member_id prescriber_npi);
  by member_id prescriber_npi;
run;
proc transpose data=inter out=t_inter;
  by member_id;
  var prescriber_npi;
run;
data want;
  merge have t_inter;
  by prescriber_id;
run;
Ksharp
Super User
Check COPY statement.


PROC TRANSPOSE DATA=WORK.NON_ENR_PROV_NPI_LIST OUT=PROV_TEST(DROP=_NAME_ _LABEL_);

BY MEMBER_ID;

VAR PRESCRIBER_NPI; 

copy

PROV_LAST_NAME 
PROV_FIRST_NAME 
prov_location_city 
prov_location_state 
prov_location_POSTAL_CODE;

RUN;


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
  • 18408 views
  • 2 likes
  • 3 in conversation