Hello,
When I proc import my CSV file, some of the values are truncated. I'm think because the first variable has a length=39, which is causing longer variables to be truncated. How do i avoid this issue?
%web_drop_table(WORK.IMPORT1);
FILENAME REFFILE "data.csv";
PROC IMPORT DATAFILE=REFFILE
DBMS=csv
OUT=WORK.IMPORT1;
GETNAMES=YES;
RUN;
PROC CONTENTS DATA=WORK.IMPORT1; RUN;
%web_open_table(WORK.IMPORT1);
excel spreadsheet variable:
data truncated:
PROC IMPORT is a guessing procedure, it sometimes guesses wrong. But for CSV files, the code used by PROC IMPORT is in the log, you could easily copy the code out of the log and then modify it so that it works on your data. Or, you can add the option GUESSINGROWS=MAX; into your PROC IMPORT code and this ought to work as well, but it will take a very long time if you have a large data set.
And what do the calls to the two different macros have to do with anything?
PROC IMPORT is a guessing procedure, it sometimes guesses wrong. But for CSV files, the code used by PROC IMPORT is in the log, you could easily copy the code out of the log and then modify it so that it works on your data. Or, you can add the option GUESSINGROWS=MAX; into your PROC IMPORT code and this ought to work as well, but it will take a very long time if you have a large data set.
And what do the calls to the two different macros have to do with anything?
CAUTION: You show your CSV file opened in Excel. You want to be very careful with this as if you accidentally SAVE the file when closing Excel (such as you widened a column for readability which Excel interprets as a change to the file) as Excel will change some values when saving the file. Which means that your CSV may misbehave in a number of ways.
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!
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.