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 ;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 730 views
  • 0 likes
  • 2 in conversation