I have CSV file. I am importing into SAS dataset using proc import but as result some of the data is truncated…can someone suggest if there is any better way importing……
PROC IMPORT OUT=mydata
DATAFILE="/c/clean.csv"
DBMS=CSV REPLACE;
delimiter = ";";
GETNAMES=YES;
DATAROW=2;
RUN;
add guessingrows=32000 option if you must use proc import. There is a default number of rows SAS will use to determine type and length of variables. If you have longer text after that number of rows then it is likely to get truncated. The guessingrows option tells SAS to look at more lines before setting type and length.
Yes, use datastep (there are lots of examples on the communities):
data want;
length var1-var4 $10;
infile "c:\clean/.csv" dsd missover dlm="," lrecl=32767; /* Change DLM to semicolon if needed */
input var1 $ var2 $ var3 $ var4 $;
run;
Obviously change the varx and format to what it is in your data, i.e. if you have dates and things, add formats, informats.
rakeshvvv wrote:
some of the data is truncated…
Seems a bit vague.
add guessingrows=32000 option if you must use proc import. There is a default number of rows SAS will use to determine type and length of variables. If you have longer text after that number of rows then it is likely to get truncated. The guessingrows option tells SAS to look at more lines before setting type and length.
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 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.