Hi,
I'm trying the combine two datasets sequentially but I got issues bc of the variables length were different the data sets combined but the problem when I tried to print out the result I got some issues.
this is the error that I got
I will copy the log and the contents of each dataset
Assigned_User | Char | 43 | $43. | $43. | Assigned User |
Category | Char | 19 | $19. | $19. | Category |
Closed_Date | Num | 8 | YYMMDD10. | Closed Date | |
Country | Char | 32 | $32. | $32. | Country |
Created_Date | Num | 8 | YYMMDD10. | Created Date | |
Days_Open | Char | 15 | $15. | $15. | Days Open |
Event_Start_Date | Char | 71 | $71. | $71. | Event Start Date |
Initiated_User | Char | 24 | $24. | $24. | Initiated User |
Last_Action_Date | Num | 8 | YYMMDD10. | Last Action Date | |
Last_Query_Entry | Char | 423 | $423. | $423. | Last Query Entry |
Location | Char | 15 | $15. | $15. | Location |
PAC_No | Char | 17 | $17. | $17. | PAC No |
Preferred_Terms | Char | 124 | $124. | $124. | Preferred Terms |
Query_ID | Char | 15 | $15. | $15. | Query ID |
Query_Title | Char | 53 | $53. | $53. | Query Title |
Site_Number | Char | 15 | $15. | $15. | Site Number |
Status | Char | 15 | $15. | $15. | Status |
Subject_Number | Char | 22 | $22. | $22. | Subject Number |
Verbatim_Terms | Char | 205 | $205. | $205. | Verbatim Terms |
Visit_Name | Char | 15 | $15. | $15. | Visit Name |
protocol | Char | 15 |
Assigned_User | Char | 43 | $43. | $43. | Assigned User |
Category | Char | 15 | $15. | $15. | Category |
Closed_Date | Num | 8 | DATE9. | Closed Date | |
Country | Char | 25 | $25. | $25. | Country |
Created_Date | Num | 8 | DATE9. | Created Date | |
Days_Open | Char | 15 | $15. | $15. | Days Open |
Event_Start_Date | Char | 239 | $239. | $239. | Event Start Date |
Initiated_User | Char | 25 | $25. | $25. | Init User |
Last_Action_Date | Num | 8 | DATE9. | Last Action Date | |
Last_Query_Entry | Char | 1072 | $1072. | $1072. | Last Query Details |
Location | Char | 15 | $15. | $15. | Location |
PAC_No | Char | 15 | $15. | $15. | PAC No |
Preferred_Terms | Char | 914 | $914. | $914. | Preferred Terms |
Query_ID | Char | 15 | $15. | $15. | Query ID |
Query_Title | Char | 254 | $254. | $254. | Query Title |
Site_Number | Char | 15 | $15. | $15. | Site Number |
Status | Char | 15 | $15. | $15. | Status |
Subject_Number | Char | 22 | $22. | $22. | Subject Number |
Verbatim_Terms | Char | 741 | $741. | $741. | Verbatim Terms |
Visit_Name | Char | 15 | $15. | $15. | Visit Name |
protocol | Char | 15 |
I use the same datasets in another program and I never had this error but when I try to combine them I got this error
@mona4u wrote:
I use the same datasets in another program and I never had this error but when I try to combine them I got this error
Statements like:
WARNING: Multiple lengths were specified for the variable Query_Title by input data set(s). This can cause truncation of data..
are not errors. They are telling you that may have data issues after combining the data.
A brief fairly obvious result in this demonstration.
data work.data1; x="Short text"; run; data work.data2; x="Some much longer text in this field"; run; data work.combined; set work.data1 work.data2 ; run; proc print data=work.combined; run;
which shows that the value of X was truncated when combined this way. The correction as @Cynthia_sas is easy:
data work.combined; /* the 35 below comes from the length of X in data2*/ length x $ 35; set work.data1 work.data2 ; run; proc print data=work.combined; run;
If the data sets have a different encoding then issue of invalid characters might not appear until attempting to combine the data as a single data set can only have one type of encoding.
It happens when you're dealing with a text variable with specific characters that SAS doesn't recognize.
I seem to get it more in SAS UE than on my desktop edition.
If you use the exact same data set but don't work with that variable the error does not appear. Or if you filter out the offending records you don't get the issue.
I usually get this when I'm working with the Canadian Census data and the french names have the extra symbols that are problematic.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.