BookmarkSubscribeRSS Feed
sandeep_18
Obsidian | Level 7

Hi all,

 

I have  a different categories in my report.Among those I would like to concate Category name and Category code to create a new category .Can we do that ???

please go through the below example

 Category code        category name

S16--                       cardiology

I  want new category as Cardiology(S16)

Nephrology(S17)

Categories

Category code----------S16,S17,S9,S10...

category name-----cardiology,Nephrology,Polytruma,Neurology.....

gender

surgery

surgery Name

....

....

.....

...

Measures 

 

Approved Amount

Approved count

..

...

..

 

1 REPLY 1
AMSAS
SAS Super FREQ

Hi sandeep_18

 

I'm not sure that I understand your example, but the following code will point you in the right direction hopefully.

A good place to start with this sort of problem is to check the SAS function documentation, I tend to use the SAS Function and Call Routines by Category as a great starting place. 

AMSAS

data input ;
	input catCode $ catName : $16. ;
cards ;
S16-- Cardiology
S17-- Nephrology
S9-- Polytruma
S10-- Neurology
;

data output ;
	length category $32 ; /* set the length of the new variable category to 32 characters */
	set input ; /* read the input dataset */
	category="("!!trim(compress(catCode,"-"))!!") "!!catName ; /* build the category value */
	put category= ; /* write the category value to the SAS log */
run ;