Help using Base SAS procedures

proc import as text

Reply
Frequent Contributor
Posts: 82

proc import as text

I am using a proc import step to load an xls file to sas dataset.

Now I want to export everything as text...how to do it? By default, it is importing a date like 30/06/2014 as 30JUN2014  and i don't want to reconvert it later to right format. I just want the original text.

Regular Contributor
Regular Contributor
Posts: 162

Re: proc import as text

Posted in reply to eagles_dare13

I don't know but it sounds like it is trying to be helpful.  It sees what it guesses must be a date, you don't say anything, and it says OK, I'll make it a date because I am helpful.

I would guess if you import the Excel sheet as CSV you would get more control and coudl tell SAS what to do instead of defaulting and letting the program guess. If the data came in as text it might export as text.  I would think you could convert it in SAS before exporting to whatever you want in any event.

Maybe seeing your PROC IMPORT statement would help?

Super User
Super User
Posts: 7,076

Re: proc import as text

Posted in reply to eagles_dare13

Can you provide an example?  In general I do not see SAS changing values on import.  That is something that is much more likely to happen in Excel when trying to read in a text files like a CSV file.

Super User
Posts: 7,854

Re: proc import as text

Posted in reply to eagles_dare13

When the import procedure sees something that looks like a date, it reads this into a numeric variable and assigns the default date9. format, which displays the date as you see it. You just need to assign the ddmmyy10. format before exporting.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 31

Re: proc import as text

Posted in reply to eagles_dare13

You submit the proc import procedure and then you press F4. This will show you the entire code and you can change it as you wish.

Ask a Question
Discussion stats
  • 4 replies
  • 236 views
  • 0 likes
  • 5 in conversation