either by proc import or data step with infile to read in .csv files, I notice that the last line in the data sets is blank.
Actually the last line in the .csv file has no values at all. Somehow when SAS read the data, it stops at the line below the last line in CSV.
How to solve this issue? Thanks.
With data step import, you could add the statement
if not missing(cats(of _all_));
to remove any line (observation) that is totally empty (missing).
Could you please what 'cats(of _all_)' will do in following if clause?
if not missing(cats(of _all_));
if not missing(cats(of _all_));
That only works if all variables are character, as numeric variables will render a dot in the cats(of _all), causing the string to be non-missing.
In order for this to work,
options missing = ' ';
needs to be set.
fengyuwuzu wrote:
either by proc import or data step with infile to read in .csv files, I notice that the last line in the data sets is blank.
Actually the last line in the .csv file has no values at all.
That is as expected. An empty line in a .csv file will cause the input statement to read nothing, so the variables stay "missing" for this iteration of the data step.
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 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.