BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi friends

I have a problem may be some one could help me out
i have a Char Column and it has value like C090304, C090305 , H090304 , I090306
but I have to display
H090304 - Hold From 04/03
C090304 - Cancel on 04/03
I090306 - Issued on 06/03

Can i do it using proc format. or how can i achieve. I know i can do it easyly using data step and string functions ... but i don't want to create new column.

Regards
Avi
2 REPLIES 2
GertNissen
Barite | Level 11
This is one way of doing it....[pre]

data input(keep=CharColumn);
input CharColumn $;
datalines;
H090304
C090304
I090306
;
run;

proc format;
value $type
'H' = 'Hold from'
'C' = 'Cancel on'
'I' = 'Issued on';
run;

data _format(keep=fmtname start end label);
retain fmtname '$Display';
set input(rename=(CharColumn=start));
end=start;
label=put(substr(start,1,1),type.)!!' '!!substr(start,6,2)!!'/'!!substr(start,4,2);
run;

proc format cntlin=_format; run;

proc print data=input;
format CharColumn $display.;
run;[/pre]
deleted_user
Not applicable
hey Thanks Geniz
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1124 views
  • 0 likes
  • 2 in conversation