BookmarkSubscribeRSS Feed
JJP1
Pyrite | Level 9

Hi ,

Please help on SAS DI transpose transformation option to get required output please.

Iam not getting any columns created like Valu6,Value 7...i need it till Value12 please.just to ensure that there is no value for this in final output please.

Input Data to be transposed              
               
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           
               
               
Currently Getting Output              
NAMEValue1Value2Value3Value4Value5FILE1Status       
567Q44104SSSSSBankingAAG Txn  DADANot Applicable       
20726910SSSSSAAG TxnADG   Accepted       
               
               
Required Output (SAS DI option to be mentioned please)              
NAMEValue1Value2Value3Value4Value5Value6Value7Value8Value9Value10Value11Value12FILE1Status
567Q44104SSSSSBankingAAG Txn         DADANot Applicable
20726910SSSSSAAG TxnADG          Accepted
               
               
4 REPLIES 4
LinusH
Tourmaline | Level 20

First, working with the Transpose transformation, with long to wide, is kind of awkward and really not fit for implementation with metadata, since columns are createed dynamically based on input data.

 

Second, your output data doesn't look like a data ouput, more of a report. IMO that should be taken care of by a repoirting tool, not ETL.

 

That said, you can't force Transpose to generate the exact layout you want,if your data doen't support it.

Top of my head, I can think of one solution: prepare your input data, so you'll have 12 values for at least one BY group.

Data never sleeps
JJP1
Pyrite | Level 9

Thanks @LinusH .Would you please suggest how can we create this input data please.
Currently in my SAS job value are geeting created after sort transformation and then transform transformation where value1,value2...
are created.
now.would you kindly suggest where i can create input data with all value5,value6.. please.

Any other suggestions or advises please

LinusH
Tourmaline | Level 20

I guess a preceeeding data step in a User Written transform.

For each by group, restart a counter.

Use a DO-loop to explicitly output additional records with missing values for those by groups that doesn't have 12 records/values (currently all it seems).

Data never sleeps
JJP1
Pyrite | Level 9

Thanks .Sorry to trouble you.
Would you please help on code please.kindly have a look at below screen shot of transpose job please.But the value6,value7 ...till value12 data may be coming or may not be coming from source please.

but it should create 12 values unde proc transpose output.if the values are not coming for value6,value7...value12.it should display output as null please.iam trying by taking user written node transformation after sort with below code.but still it is not created desired output but just created based on values only please (value1..value6).but the job should ceate output columns value7..value12 )please.if in case future data will be coming for value6 ..value12 then sas job should be taken care.please advise.

data work.W1B6ODL4;
  set work.W8EDMBU2;

count + 1;
  by NAME VALUE STATUS;
  if first.NAME then count = 1;
  if VALUE then count = 1;
  if STATUS then count = 1;
run;

transpose.PNG

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1692 views
  • 0 likes
  • 2 in conversation