BookmarkSubscribeRSS Feed
UV_123
Calcite | Level 5

Hi @mkeintz,

 

Thanks for your reply. 

  • The text after "includes.." and below "To be considered:" till a blank (as in the example above) should be the columns headers, and I want two columns for each. This column will be assigned values from the main data, which starts with a number, for example, 123456789123, and the fields under that number belong to it with variables name same as the column headers that we have mentioned above. 
  • All the prior rows till the first "include" can be ignored. 
  • Yes, I want only the rightmost two values, no matter how much content falls between the content identifier. And the 1st value will be under ABC_1 and the second ABC_2 (for example). 
  • The data values are not numeric but have a fixed format; for example, view 00001 no #'123456789123. 
  • The content identifiers are not always three letters long; they can vary. 

 

mkeintz
PROC Star

 

  • What is the significance of the "include" rows?  Should data for identifiers NOT in an "include" row be ignored?
  • Is every row prior to the first "include" to be ignored?
  • What is the significance of the "to be considered" row?
  • It appears that, for the "data" rows, you want only the rightmost two values, no matter how much content falls between the content identifier ("ABC", "DEF", etc) and those two values.  Is the correct?
  • Are the data values always numeric?
  • Are all the content identifiers three letters long?  If they can be longer, what is the maximum length (remember the ultimate variable names are limited to a length of 32 characters)?

 

This looks like a two step program: (1) get id's, content identifiers (future variable names), and data values in a long format, (2) transpose to a wide format.  What have you tried so far to read in the data - prior to transpose?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Tom
Super User Tom
Super User

I merged the two threads into one.

 

If you want more detailed help with parsing your file please share an actual sample of the file structure.

First use a text editor, like NOTEPAD, to replace any confidential information with similar strings. Try not to modify the pattern (ie don't replace strings that are all digits with only letters or the reverse).

UV_123
Calcite | Level 5

Hi @Tom ,

 

I have attached a .txt file that is somewhat similar to my file and the excel file has my desired output. 

 

Thank you for your help. 

 

UV_123
Calcite | Level 5

Hi  @ChrisHemedinger

 

Can you please help me delete this post as I had framed the question wrongly.

 

Thanks

ShelleySessoms
Community Manager

I will reach out to you via email @UV_123

 

@ChrisHemedinger is currently traveling.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 20 replies
  • 1788 views
  • 1 like
  • 6 in conversation