BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
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.

 

Example:

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.

bbibbi_yc
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.

ballardw
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;
53
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;


SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2951 views
  • 0 likes
  • 8 in conversation