DATA Step, Macro, Functions and more

Could the length be formated when using proc import?

Accepted Solution Solved
Reply
Super Contributor
Posts: 394
Accepted Solution

Could the length be formated when using proc import?

Hello:

 

I have a proc import code below.   I found some columns were truncated after the import procedure.   Could I format some specific column length to avoid this situation?  Thanks.

 

PROC IMPORT OUT=Poverty&state.&year

DATAFILE= "&importfolder.\&state.\&year.\Poverty&year..csv"

DBMS=CSV REPLACE;

GETNAMES=YES;

DATAROW=3;

RUN;


Accepted Solutions
Solution
‎10-31-2017 11:57 AM
Super User
Posts: 23,237

Re: Could the length be formated when using proc import?

No. If you use PROC IMPORT you cannot specify column lengths/types, you need to use a data step to have full control. You can set GUESSINGROWS=MAX to see if PROC IMPORT works, but a data step is better in the long run. And it's faster.

View solution in original post


All Replies
Solution
‎10-31-2017 11:57 AM
Super User
Posts: 23,237

Re: Could the length be formated when using proc import?

No. If you use PROC IMPORT you cannot specify column lengths/types, you need to use a data step to have full control. You can set GUESSINGROWS=MAX to see if PROC IMPORT works, but a data step is better in the long run. And it's faster.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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