BookmarkSubscribeRSS Feed
MarcusX
Calcite | Level 5

I will give a picture of the text file that i am working with and the output that coming from my code. I have to read these variables in from the raw data file and use some functions on them. I am having a very hard time reading these file in properly in order for me process the functions on them. The pictures are attached below:

 

President_Data.PNGPresident_output.PNG

4 REPLIES 4
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

please provide a sample of the SAS code you used to create the second table.

 

Reeza
Super User

What is the delimiter between the variables? I suspect it's a tab, "09"x. 

Try explicitly specifying a delimiter. 

 

Please post your questions as text, not images.

 


@MarcusX wrote:

I will give a picture of the text file that i am working with and the output that coming from my code. I have to read these variables in from the raw data file and use some functions on them. I am having a very hard time reading these file in properly in order for me process the functions on them. The pictures are attached below:

 

President_Data.PNGPresident_output.PNG


 

ballardw
Super User

And with delimited data either use the : format modifier or an informat statement separate from the input statement. Without the : then the input statement is forced to read the specified number of columns such as are resulting in some of your names that are actually shorter than 18 characters to read characters from the next field.

 

PS: Post code into a code window opened with the forum's {I} icon. It is much easer to copy and paste and then we can show suggestions easier than retyping from an image.

 

Same with example text files being read. The {I} icon is plain text and will maintain appearance and columns from a text file.

Shomo_olongus
Calcite | Level 5

Please can you provide just the first 20 rows of your data (attached the file to the post) and your code, so we can help you with your code to correctly read your data?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 934 views
  • 0 likes
  • 5 in conversation