BookmarkSubscribeRSS Feed
robertrao
Quartz | Level 8

Hi,

In the below I want to create a new variable new_code which groups all the codes in the 45 series....

I have shown it for some on the extreme right of the table..

Thanks

ID       LOS   ICU_LOS    CODE     SURG_DATE   LAB_DATE         LAB        LAB_VALUE   NEW_CODE
101     8        1.08              45.79       02FEB2011     04FEB2011        BUN         20                    45.XX
101     8        1.08              45.79       02FEB2011     04FEB2011        WBC        10.1                 45.XX
101     8        1.08              45.79       02FEB2011     04FEB2011        HEMAT    29.9
101     8        1.08              45.79       02FEB2011     04FEB2011        PLATE     151
101     8        1.08              45.79       02FEB2011     08FEB2011        WBC         9.1
101     8        1.08              45.79       02FEB2011     08FEB2011        HEMAT     25
101     8        1.08              45.79       02FEB2011     08FEB2011        PLATE     159                 45.XX
102    84      45.81            45.73       19NOV2010     03JAN2011      BUN             11                 45.XX
102    84      45.81            45.73       19NOV2010     03JAN2011      ALBU            2.9               45.XX
102    84      45.81            45.73       19NOV2010     03JAN2011      WBC             4.8
102    84      45.81            45.73       19NOV2010     03JAN2011      HEMAT          24.4
102    84      45.81            45.73       19NOV2010     03JAN2011      PLATE           72
102    84      45.81            45.73       19NOV2010     03JAN2011      WBC             5.4
102    84      45.81            45.73       19NOV2010     03JAN2011      HEMAT         26
102    84      45.81            45.73       19NOV2010     03JAN2011      PLATE           89
103  11         50                45.79      08JAN2011       11JAN2011       WBC           17.8            45.XX
103  11         50                45.79      08JAN2011       11JAN2011       HEMAT        40.9           45.XX
103  11         50                45.79      08JAN2011       11JAN2011       PLATE        307             45.XX
103  11         50                45.79      08JAN2011       11JAN2011       BUN            8                 45.XX
103  11         50                45.79      08JAN2011       11JAN2011      WBC          10.1
103  11         50                45.79      08JAN2011       11JAN2011       HEMAT      34
103  11         50                45.79      08JAN2011       11JAN2011       PLATE        270
103  11         50                45.79      08JAN2011       11JAN2011       BUN           70
2 REPLIES 2
Patrick
Opal | Level 21

Would something as below work?

new_code=floor(code);

SteveDenham
Jade | Level 19

I don't follow the logic for the new_code variable.  What drives whether the value is kept with the new value versus whether the new value is missing?

Steve Denham

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 ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1294 views
  • 0 likes
  • 3 in conversation