BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ksharp
Super User
filename in 'c:\temp\values.sas';      /*original sas code*/  
filename out 'c:\temp\new_values.sas'; /*processed sas code*/

data _null_;
infile in;
file out;
input;
if first(left(_infile_)) in ('.' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9')
   and findc(_infile_,"=") and findc(_infile_,"'") then 
_infile_=prxchange("s/'\d+\s+/'/",1,_infile_);
put _infile_;
run;
tdegen
Calcite | Level 5

*THIS* is the type of shenanigans I was talking about.

THANK YOU!!!

 

To everyone else - you all brought up great points and some suggestions were "better" than the type of solution I was looking for.  Unfortunately, given the constraints I'm working with a quick and dirty script was the best/only viable solution.

 

Thanks everyone!

data_null__
Jade | Level 19

It would be much easer to edit the formats after they are created and then recreate the FMTLIB.  You say they will run whatever you give them this should suffice.  This example uses LIB=WORK.FORMATS you will need to change for permanent format library. 

 

* what you have;
proc format;

VALUE TED_DONOR
.B = 'Unknown'
.C = 'Not answ/Inconsist'
1 = '1 HLA-identical sibling'
2 = '2 Syngeneic'
3 = '3 Related Donor, match status unknown'
4 = '4     Matched Unrelated Donor (MUD)'
31 = '31 HLA-matched other relative'
32 = '32 HLA-mismatched relative'
41 = '41 HLA matched unrelated'
42 = '42 HLA mismatched unrelated'
;

VALUE PTTXTYPE
1 = '(1) Allo only'
2 = '(2) Auto only'
3 = '(3) Allo transplant(s) then Auto(s)'
4 = '(4) Auto transplant(s) then by Allo(s)'
5 = '(5) Allo transplant(s) then DCI'
6 = '(6) Auto transplant(s) then Allo(s) then DCI'
;
VALUE TEDVSRES
1 = '1 TED'
2 = '2 CRF (RES)'
3 = '3 moved CRF (RES) to TED'
4 = '4 		moved TED to CRF (RES)'
5 = '5 moved CTRM to TED'
6 = '6 Cellular Therapy Regenerative Medicine (CTRM, CTR)'
7 = '7 Auto no Consent'
8 = '8 moved TED to CTRM'
;
quit;


*this is the script you need insert in the process;

proc format lib=work.formats cntlout=cntlout;
   quit;

data cntlin;
   set cntlout;
   if type eq 'N' then do;
      if not missing(input(start,32.)) then do;
         label = left(compress(substr(label,anyspace(label)),'09'x));
         end;
      end;
   run;
proc format cntlin=cntlin fmtlib;
   quit;

 

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 17 replies
  • 6390 views
  • 0 likes
  • 7 in conversation