BookmarkSubscribeRSS Feed
christinawkhau
Calcite | Level 5
Ho what does the following do:

Value $exfmt ’ZHKGILD’ =’8#1’
’ZHKGILPM1’ = ’6G8’
3 REPLIES 3
Tom
Super User Tom
Super User

Looks like part of a PROC FORMAT step for defining a character format named $EXFMT.  You are missing the PROC FORMAT statement before the VALUE statement.  You are using "stupid" quotes instead of normal quotes around the strings, that needs to be fixed.  And you are missing the semi-colon to end the VALUE statement. Also you should end the PROC FORMAT step with a RUN statement.

 

proc format;
  value $exfmt
    'ZHKGILD' = '8#1'
    'ZHKGILPM1' = '6G8'
  ;
run;

When you use this format to print a character variable strings that match the values on the left of the equal signs will be displayed using the values on the right.  Just when you print a number that has value ten in it using the 2. format is print the digit string 10.  Or when you have date value of the first day of january 2022 and print it using the DATE9. format you get the string 01JAN2022 instead of the actual number of days since 1960 that are stored in the variable.

christinawkhau
Calcite | Level 5
Thanks
Yes and my question is what exactly $exfmt if the program runs?

I am readinf others program so never see this term before

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 318 views
  • 1 like
  • 2 in conversation