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

hi,iam trying to convert the data below to tranpose in SAS DI,but iam not getting what iam expecting.please help.

 

Sample data input to transpose:

 

ValueNAMEFILE1Status
SSSSS567Q44104DADANot Applicable
SSSSS20726910 Accepted
Banking567Q44104DADANot Applicable
AAG Portf567Q44104DADANot Applicable
AAG PortfS68855kl Not Applicable
FailedS68855kl Not Applicable
CacheS68855kl Not Applicable
AAG Txn567Q44104DADANot Applicable
AAG TxnS68855kl Not Applicable
AAG Txn20726910 Accepted
ADF20718435 Accepted
ADG20726910 Accepted
CXES68855kl Not Applicable

 

After transpose sample output as below :

 

NAMEValue1Value2Value3Value4Value5FILE1Status
567Q44104SSSSSBankingAAG Txn  DADANot Applicable
20726910SSSSSAAG TxnADG   Accepted

i was using below ,but not working as expected.please help.

PROC SORT
	DATA=WORK.TEST
	OUT=WORK.SORTTempTableSorted
	;
	BY NAME;
RUN;
PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
	OUT=TRNSTRANSPOSED
	PREFIX=VALUE;
	BY NAME;
	VAR VALUE;
	COPY STATUS FILE1;
RUN; QUIT;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You are very close.

 

 

data test;
infile cards expandtabs truncover;
input  Value $	NAME: $20.	FILE1 $	Status $20.;
cards;
SSSSS	567Q44104	DADA	Not Applicable
SSSSS	20726910	 .	Accepted
Banking	567Q44104	DADA	Not Applicable
AAGPortf	567Q44104	DADA	Not Applicable
AAGPortf	S68855kl	. 	Not Applicable
Failed	S68855kl	 .	Not Applicable
Cache	S68855kl	 .	Not Applicable
AAGTxn	567Q44104	DADA	Not Applicable
AAGTxn	S68855kl	 .	Not Applicable
AAGTxn	20726910	. 	Accepted
ADF	20718435	 .	Accepted
ADG	20726910	 .	Accepted
CXE	S68855kl	 .	Not Applicable
;

PROC SORT
	DATA=WORK.TEST
	OUT=WORK.SORTTempTableSorted
	;
	BY NAME FILE1 	Status;
RUN;
PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
	OUT=TRNSTRANSPOSED
	PREFIX=VALUE;
	BY NAME FILE1 	Status;
	VAR VALUE;
RUN; 

View solution in original post

3 REPLIES 3
Ksharp
Super User

You are very close.

 

 

data test;
infile cards expandtabs truncover;
input  Value $	NAME: $20.	FILE1 $	Status $20.;
cards;
SSSSS	567Q44104	DADA	Not Applicable
SSSSS	20726910	 .	Accepted
Banking	567Q44104	DADA	Not Applicable
AAGPortf	567Q44104	DADA	Not Applicable
AAGPortf	S68855kl	. 	Not Applicable
Failed	S68855kl	 .	Not Applicable
Cache	S68855kl	 .	Not Applicable
AAGTxn	567Q44104	DADA	Not Applicable
AAGTxn	S68855kl	 .	Not Applicable
AAGTxn	20726910	. 	Accepted
ADF	20718435	 .	Accepted
ADG	20726910	 .	Accepted
CXE	S68855kl	 .	Not Applicable
;

PROC SORT
	DATA=WORK.TEST
	OUT=WORK.SORTTempTableSorted
	;
	BY NAME FILE1 	Status;
RUN;
PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
	OUT=TRNSTRANSPOSED
	PREFIX=VALUE;
	BY NAME FILE1 	Status;
	VAR VALUE;
RUN; 
JJP1
Pyrite | Level 9

Thanks @Ksharp for kind and Quick response and  it is working as expected.

would anyone please suggest how can we run the same code in SAS Di please.

actually I can see the transpose transformation in sAS DI.iam selecting the columns as per below code in transpose transformation.

but iam not getting required ouput.can you kindly help please

 

PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
OUT=TRNSTRANSPOSED
PREFIX=VALUE;
BY NAME FILE1 Status;
VAR VALUE;
RUN;

 

and in mapping taken the columns VALUE NAME  FILE1   Status.

 

iam not getting the transposed output in SAS DI when i open the workoutput .please help

JJP1
Pyrite | Level 9

Thanks.I got it.i need to set "Update the metadata for the target tables option is set to Yes" which was missing in proc transpose node.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 539 views
  • 1 like
  • 2 in conversation