BookmarkSubscribeRSS Feed
chatty
Calcite | Level 5

I am trying to merge a txt file and a SAS file. The text file (so tried to change it via dbms=dlm) and the file is not configured properly and I have to assign variables to certain columns (eg columns 6-7 represent age, but we have to code for that bc the numbers are just raw data). The names in the SAS file are too long and so I tried renaming them something more code appropriate eg weight_lbs but also received errors. When trying to do a "keep" command to show the variables to keep, I got the error  for both. the sets are called "dep" and "nutrition" error is "work.dep.data does not exist" and "work.nutrition.data does not exist". Bc of this wen I try to merge it says that there are no shared values, but I want to the values of only observations in both files. 

2 REPLIES 2
tomrvincent
Rhodochrosite | Level 12
I'd suggest working with each one individually. Get familiar with the data in each and then make enhancements to get them to merge.
Kurt_Bremser
Super User

What do you mean by "SAS file"? Is it a SAS dataset?

 

For detailed help, we need to know the data you are working with.

Post a few lines of the text file (including the header line, if there is such), using the {i} button, so the data is posted as-is.

For SAS datasets, post code with a data step with datalines, so we can create an exact copy of your dataset. Use the "little running man" for posting code.

A macro to automatically convert SAS datasets to data step code can be found in my footnotes.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 787 views
  • 0 likes
  • 3 in conversation