Hi All,
I want to update existing format.
i tried
proc format library = work.formats
cntlout = cntlout;
run;
Now i want to update value for the existing format.
Format name :- FMT1
Old Value - ' OLDNAME' to New Value - ' NEWNAME'
so next time it should pickup NEWNAME so how to update existing format FMT1 Value ?
Please advise.
Thank you,
Sanket
@Sanket wrote:
Hi All,
I want to update existing format.
i tried
proc format library = work.formats
cntlout = cntlout;
run;
Now i want to update value for the existing format.
Format name :- FMT1
Old Value - ' OLDNAME' to New Value - ' NEWNAME'
so next time it should pickup NEWNAME so how to update existing format FMT1 Value ?
Please advise.
Thank you,
Sanket
You created a new dataset that describes all the formats in WORK when you ran
proc format library = work.formats cntlout = cntlout;
run;
Now you can look in that dataset (WORK.CNTLOUT) and replace the value you want to have replaced.
After that, use the dataset as input for proc format:
proc format library = work.formats cntlin = cntlout;
run;
Post test datas in the form of a datastep if you want exact answers. This is just the theory - use cntlout to get a dataset as you have done, updated that dataset as you want, then cntlin in proc format to read the dataset back in.
@Sanket wrote:
Hi All,
I want to update existing format.
i tried
proc format library = work.formats
cntlout = cntlout;
run;
Now i want to update value for the existing format.
Format name :- FMT1
Old Value - ' OLDNAME' to New Value - ' NEWNAME'
so next time it should pickup NEWNAME so how to update existing format FMT1 Value ?
Please advise.
Thank you,
Sanket
You created a new dataset that describes all the formats in WORK when you ran
proc format library = work.formats cntlout = cntlout;
run;
Now you can look in that dataset (WORK.CNTLOUT) and replace the value you want to have replaced.
After that, use the dataset as input for proc format:
proc format library = work.formats cntlin = cntlout;
run;
Use the "little running man" icon in the top of your "Post" or "Reply" window to post SAS code. This preserves the formatting and even gives you enhanced-editor-like coloring:
proc format;
value $id
'1'='Mary'
'2'='Tom'
'3'='Joe'
;
run;
options fmtsearch=(work);
proc format fmtlib library=work.formats;
select $id;
run;
quit; * not necessary;
proc format library = work.formats cntlout = cntlout;
select $id;
run;
proc sql;
update cntlout
set LABEL='Kim'
where label='Joe';
quit;
proc format library = work.formats cntlin = cntlout;
select $id;
run;
proc format library = work.formats cntlout = cntlout;
select $id;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.