Hi Everyone,
I find that when a scv file has so many initial blank cell, my SAS code will not import correctly and it cause me trouble as I mentioned in the previous post (https://communities.sas.com/t5/Base-SAS-Programming/Import-issue/m-p/402819#M97858)
So I create this sample file and I wish you could help me to import correctly.
In this file, the first column has number at the first cell and SAS import the last row correctly.
For the other 2 column (bad1 bad2), many blank cell on top which make SAS import wrong. the value 350 in bad1 (last row) turn to 3. The value 2000 in bad2 turn to 2.
By the way, I have to use Import in my work
proc import datafile="...\error.csv"
out=error dbms=csv replace;
getnames=yes;
run;
data error; set error;
N=_N_;
if good^=. or bad1^=" " or Bad2^=" ";run;
I really appreciate your help.
HC
Add a GUESSINGROWS option and make it a big number. Then PROC IMPORT will scan more records before it determines the types.
This will slow down your processing.
proc import datafile="...\error.csv"
out=error dbms=csv replace;
getnames=yes;
guessingrows=1000000;
run;
Add a GUESSINGROWS option and make it a big number. Then PROC IMPORT will scan more records before it determines the types.
This will slow down your processing.
proc import datafile="...\error.csv"
out=error dbms=csv replace;
getnames=yes;
guessingrows=1000000;
run;
You save my day!!!
Thanks a lot.
HHC
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.