BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RandoDando
Pyrite | Level 9

I am importing a CSV file which has blank values in a numeric field.  The blanks are in delimited file as simply two sequential commas.   I want to read those as . but SAS is skipping over them.  I tried the MISSOVER option but it is still going to the next variable.  The variable with the missing values is "Rate".  It is in the CSV file as percents (with the % signs), so I had to specify the :percent. format option then change it to Percent10.2 after the import.  I want blanks to be imported as blanks (which is . for numeric data). 

 


data one;
 infile "\\...MyFile.csv" dlm=',' firstobs=2 missover  ;
 length state county $24;
 input State $ County $ FIPS  Population Total  rate :percent. score  ;
rename county = county_name;
format rate Percent10.2;
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Try the DSD option and TRUNCOVER.

 

infile "\\...MyFile.csv" DSD firstobs=2 TRUNCOVER;

For your percent you may want an informat instead.

 

 length state county $24;
  informat rate percent.;
 input State $ County $ FIPS  Population Total  rate  score  ;

@RandoDando wrote:

I am importing a CSV file which has blank values in a numeric field.  The blanks are in delimited file as simply two sequential commas.   I want to read those as . but SAS is skipping over them.  I tried the MISSOVER option but it is still going to the next variable.  The variable with the missing values is "Rate".  It is in the CSV file as percents (with the % signs), so I had to specify the :percent. format option then change it to Percent10.2 after the import.  I want blanks to be imported as blanks (which is . for numeric data). 

 


data one;
 infile "\\...MyFile.csv" dlm=',' firstobs=2 missover  ;
 length state county $24;
 input State $ County $ FIPS  Population Total  rate :percent. score  ;
rename county = county_name;
format rate Percent10.2;
run;

 

 


 

View solution in original post

1 REPLY 1
Reeza
Super User

Try the DSD option and TRUNCOVER.

 

infile "\\...MyFile.csv" DSD firstobs=2 TRUNCOVER;

For your percent you may want an informat instead.

 

 length state county $24;
  informat rate percent.;
 input State $ County $ FIPS  Population Total  rate  score  ;

@RandoDando wrote:

I am importing a CSV file which has blank values in a numeric field.  The blanks are in delimited file as simply two sequential commas.   I want to read those as . but SAS is skipping over them.  I tried the MISSOVER option but it is still going to the next variable.  The variable with the missing values is "Rate".  It is in the CSV file as percents (with the % signs), so I had to specify the :percent. format option then change it to Percent10.2 after the import.  I want blanks to be imported as blanks (which is . for numeric data). 

 


data one;
 infile "\\...MyFile.csv" dlm=',' firstobs=2 missover  ;
 length state county $24;
 input State $ County $ FIPS  Population Total  rate :percent. score  ;
rename county = county_name;
format rate Percent10.2;
run;

 

 


 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2487 views
  • 1 like
  • 2 in conversation