BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Super User Tom
Super User

So that means that EDU and MAR were created as CHARACTER variables by PROC IMPORT.

If you expected them to be numeric then you need to look at the XLS file and find out why they are not numeric.


Or you could change the format definition to define a character format.



value $mar '1'='Single' '2'='Married' '3'='Widowed' '4'='Divorced';

But be careful because the string '1' and the string ' 1' are two different strings.

Calcite | Level 5

It's indeed not in numerical form. Thank you very much for helping me identify the problem. I'm sorry for taking up so much of everyone's time.

Super User

@bbibbi_yc wrote:

Hello, that means I can't see the 'Single' or other else in my table?

It sounds like a stupid question, but I really don't understand. Thank you for your patient response.

WHICH dataset (not table at this point). You have at least two data sets shown in a picture of your code.



SAS variables always have a format assigned. The format controls how SAS will display the values by default. In many cases for numeric values you SAS will default to something like BEST12. , which means it will make an attempt to display the value in 12 characters. IF you create a custom format and permanently assign it to a variable then the format has to be available to the current session for use, otherwise SAS will fall back on the default. To have a custom format available in a session you either have to run the code to recreate the format OR create the format(s) in a permanent library that is active and add the path to that format storage with the SAS option FMTSEARCH, which tells SAS where to look for formats in addition to the SAS default formats. For beginning SAS users I recommend rerunning the format code.


There is actually a SAS option that will prevent use of a data set with a custom format that SAS can't find. An example from my LOG setting the option and then attempting to use a format that is not defined:

52   options fmterr;
54   proc freq data=sashelp.class;
55      tables sex;
56      format sex $mysexformat.;
ERROR: The format $MYSEXFORMAT was not found or could not be loaded.
57   run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 17 replies
  • 8 in conversation