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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: