BookmarkSubscribeRSS Feed
buddha_d
Pyrite | Level 9
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
7 REPLIES 7
Reeza
Super User

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.

art297
Opal | Level 21

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

 

buddha_d
Pyrite | Level 9
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.
art297
Opal | Level 21

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

 

Art, CEO, AnalystFinder.com

 

buddha_d
Pyrite | Level 9

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,

 

art297
Opal | Level 21

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

Reeza
Super User

@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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1043 views
  • 1 like
  • 3 in conversation