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

Hi,

 

I am unable to properly informat the date from my csv file. When I do a proc import or using the import wizard, the date is cut off to have a format of $1. and informat of $1.

 

proc import datafile='C:***********.csv'
 dbms=csv out=work.test replace;
run;

 

I have tried including "input Date MMDDYY10." in the proc import statement but it does not work.

My date format from the csv file is 12/31/2017 but it is currently only showing up as the first character or "1". 

 

Thank you for your help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
GUESSINGROWS=MAX;

In general, PROC IMPORT guesses, and it can guess wrong. Especially if the first records it encounters are only length 1 or it has mixed values. 

 

You can set GUESSINGROWS=MAX to avoid this but it scans the whole file first which can be time consuming. In general, you're better off writing a data step with INPUT and specifying the lengths ahead of time. See the log for an example of how you would write the code or to use it as starter code and modify as needed.

 


@dlazer1 wrote:

Hi,

 

I am unable to properly informat the date from my csv file. When I do a proc import or using the import wizard, the date is cut off to have a format of $1. and informat of $1.

 

proc import datafile='C:***********.csv'
 dbms=csv out=work.test replace;
run;

 

I have tried including "input Date MMDDYY10." in the proc import statement but it does not work.

My date format from the csv file is 12/31/2017 but it is currently only showing up as the first character or "1". 

 

Thank you for your help!

 


 

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

The import wizard generates code.

What does that look like? Would modifying it be a solution?

Otherwise it's hard to comment without seeing the first few lines of the CSV file.

Reeza
Super User
GUESSINGROWS=MAX;

In general, PROC IMPORT guesses, and it can guess wrong. Especially if the first records it encounters are only length 1 or it has mixed values. 

 

You can set GUESSINGROWS=MAX to avoid this but it scans the whole file first which can be time consuming. In general, you're better off writing a data step with INPUT and specifying the lengths ahead of time. See the log for an example of how you would write the code or to use it as starter code and modify as needed.

 


@dlazer1 wrote:

Hi,

 

I am unable to properly informat the date from my csv file. When I do a proc import or using the import wizard, the date is cut off to have a format of $1. and informat of $1.

 

proc import datafile='C:***********.csv'
 dbms=csv out=work.test replace;
run;

 

I have tried including "input Date MMDDYY10." in the proc import statement but it does not work.

My date format from the csv file is 12/31/2017 but it is currently only showing up as the first character or "1". 

 

Thank you for your help!

 


 

dlazer1
Calcite | Level 5

Thank you! This worked. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 2928 views
  • 1 like
  • 3 in conversation