Hello experts,
I have something like
proc format;
value $country
"United states of America"="US"
------
-----
"Russia"= "RU";
run;
about 22 countries list
I would like to know how to use control in and out format if that can be used to parametrize user defined formats. Is it possible to make this existing proc format statements(like the above) read a new a new list of different countries and their label by using a parameter? I see the next list is having countries staring from "argentina"= "arg"...."India"=Ïnd" and also the point to note is that the count of countries tend to differ too depending on what's in the next list..A macro will help ?
Any help would mean a lot. Thanks
You can use the cntlout= option to copy all existing formats to a SAS dataset. This can be distributed for review or stored as a backup. It can be exported to Excel for amendment and then imported back into SAS. There are a lot of columns but the main ones to review are called start and end, the start and end values for a range covered by a single formatted value. Additional rows can be entered if required. The modified table can then be read back into proc format using cntlin=. Make sure no-one has renamed any of the columns.
Proc format cntlin=work.formatlist ; quit ;
You can also create a cntlin table to add a new format into the library, from a lookup table in the database. At a minimum you need to define s start column, a label column to hold the formatted value, and a fmtname column as the name of the format. A HLO column is often useful to define how the format will handle out of range values.
Richard
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.