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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 580 views
  • 0 likes
  • 2 in conversation