BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sanket
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@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;

 

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Kurt_Bremser
Super User

@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;

 

Sanket
Fluorite | Level 6
Thank you !! KurtBresmer 🙂 It worked fine on Friday I tried with an below example. proc format; value $id '1'='Mary' '2'='Tom' '3'='Joe' ; run; options fmtsearch=(work); proc format fmtlib library=work.formats; select $id; run; quit; proc format library = work.formats cntlout = cntlout; select $id; run; proc sql; update cntlout set LABEL='Kim' where label='Joe'; quit; 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; select $id; run; proc format library = work.formats cntlout = cntlout; select $id; run;
Kurt_Bremser
Super User

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; 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 6250 views
  • 1 like
  • 3 in conversation