BookmarkSubscribeRSS Feed
SamuelRajKandru
Quartz | Level 8

jobfmt.pngpayrolljobcode.pngpayrollprint.pnglogerror.png

 

I tried to create a character format and when I use the format in the print statement, the log window displays the following error. I defined the format type to be a character type format. But the error message tells me that I'm using a numerical format type on a character variable. What can be the solution? how can JobCode's - mixed values (character and numeric type) be displayed using a proc format? Is it possible? If no, is there any other solution for this? 

3 REPLIES 3
Kurt_Bremser
Super User

When you create the format $JOBF with proc format, you also must use the format $JOBF (note the dollar sign) in the format statement that assigns the format to a variable. A format without the dollar sign is always indicating a numeric format.

SamuelRajKandru
Quartz | Level 8
Done that, but of no use. My variable has mixed values. So I need to figure how to create a format for the jobcode values like 'ME2' and 'SE3'. Is there any way?
Kurt_Bremser
Super User

"Mixed values" does not mean mixed type. If your variable can contain alphanumeric values, then your variable is of type character, period.

So you must create and use a character format.

If you have numeric values in your string that need to be displayed with a generic number format, you will have to do a character-to-numeric conversion before applying a numeric format.

 

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 938 views
  • 0 likes
  • 2 in conversation