DATA Step, Macro, Functions and more

Proc import challenges

Reply
Contributor
Posts: 71

Proc import challenges

SAS community,
I am getting weird names as I import data from excel(e.g.: & instead of & symbol in text field). I solved one column giving htmldecode(columnname1); option but if I give second column the same (hmtldecode(column2); ) then sas EG giving errors.
How can give htmldecode option to dataset so that anywhere & or ' symbol gets imported properly.

Thanks
Super User
Posts: 17,840

Re: Proc import challenges

[ Edited ]

Why do you have those in the first place? Can you fix your import process ahead of this step instead?

 

Post a sample of the data set you're trying to import or a fake dataset that will replicate your issue if you want help with code.

PROC Star
Posts: 7,363

Re: Proc import challenges

You can only use it on character fields. Could that be the problem you are confronting (i.e., trying to apply it to numeric fields)?

 

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 71

Re: Proc import challenges

Art, the fields are character fields only. I checked it again.
Reeza, I posted a dummy dataset in my previous posts. It's just character fields with & ' with names coming off wrong. I don't know if it's SasEG or what? If u know a way to fix while doing proc import please let me know.
PROC Star
Posts: 7,363

Re: Proc import challenges

At least two of the fields mentioned in your original post were numeric.

 

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 71

Re: Proc import challenges

Art, you might be correct, but this is data I created. while importing (proc import) date_time is converting to numeric and while using proc format with picture statement, it is assigned to my library. I am sending the sheet again.

            When I use that format in my data , sas log is saying it can't recognize that format (though it is assigned to the library). Could it be because when I am defining proc format (date_time is numeric, with picture statement) and while converting to character it messes up? 

 

thanks,

 

PROC Star
Posts: 7,363

Re: Proc import challenges

[ Edited ]

Can't answer your question without seeing the data, the code you used to import it, and the code your talking about now.

 

Otherwise, we'd just be guessing and possibly misleading you.

 

Need to see the SAS file that was created as a result of the import. That will let us know what we're dealing with. Can't begin to replicate the process with the file you already sent (twice now as it's the same one as you originally posted), as it doesn't contain any of the characters you are trying to change and, besides, doesn't let us know what happened during the import. I, for one, can't replicate your process because I'm using SAS UE and it doesn't include dbms=excel.

 

Art, CEO, AnalystFinder.com

Super User
Posts: 17,840

Re: Proc import challenges


buddha_d wrote:
Art, the fields are character fields only. I checked it again.
Reeza, I posted a dummy dataset in my previous posts. It's just character fields with & ' with names coming off wrong. I don't know if it's SasEG or what? If u know a way to fix while doing proc import please let me know.

How about you help me, help you, by pointing it out rather than having me search through your historical posts?

Ask a Question
Discussion stats
  • 7 replies
  • 138 views
  • 1 like
  • 3 in conversation