Hello, I have several sas tables (T1, T2, T3, etc.) I want to concatenate its different tables.
I do the data step correctly with the set instruction. But I get empty lines. On the documentation, it states to see the types of certain variables and to order the variables. I've done it but I still get empty observations.
I cannot send an extract of the bases because I cannot find the examples that I know how to create to reflect the problem. Thank you for understanding.
Can anyone give me some hints ?
THANKS.
Gick
Please post the complete log of your DATA step, and describe in detail what you mean by "empty lines".
@Gick Put yourself into our shoes and try to imagine if you really could say what you're doing with the depth and breath of information you've provided so far. Thank you for your understanding.
I'm going to repeat something in a bit more detail that you aren't paying attention to:
If variables of the same name are of different data types then one or more sets of the values will be missing in the output because a variable can only be ONE TYPE in a data set, either character or numeric. If you try to put an "ABC" into a variable that is numeric it will always fail, result in a missing value and generally the log will tell you that you did something wrong.
In this case I would expect an error such as this shows from attempting to combine two sets with the same named variable of different types:
196 data one; 197 x=123; 198 run; NOTE: The data set WORK.ONE has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 199 200 data two; 201 x='ABC'; 202 run; NOTE: The data set WORK.TWO has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 203 204 data combined; 205 set one 206 two 207 ; ERROR: Variable x has been defined as both character and numeric. 208 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.COMBINED may be incomplete. When this step was stopped there were 0 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Depending on what you have been doing, exact code and data sets you may be looking at an earlier data set as a result. But that is why we have asked you to show the LOG of your attempt, including the code and all the notes, messages, warnings and/or errors like above.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.