LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 26 Feb 2007 12:12:51 -0500
Reply-To:   Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject:   Re: How many in a single year ; in more than a single year and etc
Comments:   To: Irin later <irinfigvam@yahoo.com>
Content-Type:   text/plain; charset="windows-1255"

Irin,

If process_yyyymm is a SAS date, you can use the YEAR function to extract the year from it:

process_yyyy = YEAR(process_yyyymm);

If process_yyyymm is simply a numeric value (which IMO is a poor way to store YYYYMM date info), you could use the SUBSTR and PUT functions to get the first 4 characters:

process_yyyy = substr(put(process_yyyymm,6.),1,4);

This second approach converts the numeric variable to character, then takes the first 4 bytes of the value.

Hope this is helpful.

Jack Clark

Research Analyst

Center for Health Program Development and Management

University of Maryland, Baltimore County

_____

From: Irin later [mailto:irinfigvam@yahoo.com] Sent: Monday, February 26, 2007 10:32 AM To: Jack Clark; SAS-L@LISTSERV.UGA.EDU Subject: Re: How many in a single year ; in more than a single year and etc

It looks like this code works. However I wonder if it works properly. Now I doubt if I should count process year as I initially set.

I mean…probably I should FIRST take out month part in order to use just year count:

Process_Yyyy

2005

2004

2003

rather than :

Process Yyyymm

200504 200501 200408 200504 200402 200309

Proc contents shows that Process Yyyymm field is numeric:

# Variable Type Len Pos Format Informat Label

1 Process_Yyyymm Num 8 32 Process Yyyymm

Considering it is numeric…How can I take month part out in order to use below code?

proc sql;

create table new as

select adm_key, count(distinct process_Yyyy) as year_cnt, count(*) as

adm_cnt

from disch_2004

group by adm_key

;

quit;

proc freq data = new;

tables year_cnt / nocum nopercent;

weight adm_cnt;

run;

How can I take month part out of the numeric value ( 200508)?

Thank you in advance!

Irin

Jack Clark <JClark@CHPDM.UMBC.EDU> wrote:

Irin,

See if this gets what you are after...

data test; input Adm_key adm_mem_num Process_Yyyymm; process_yr = substr(left(process_yyyymm),1,4); cards; 8 12 200502 8 12 200504 9 11 200501 9 11 200408 7 10 200504 7 10 200402 7 10 200309 ; run;

proc sql; create table new as select adm_key, count(distinct process_yr) as year_cnt, count(*) as adm_cnt from test group by adm_key ; quit;

proc freq data = new; tables year_cnt / nocum nopercent; weight adm_cnt; run;

Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Irin later Sent: Friday, February 23, 2007 2:55 PM To: SAS-L@LISTSERV.UGA.EDU Subject: How many in a single year ; in more than a single year and etc

I have Adm_key ; Adm_mem_num fields and process_year.

Adm_key adm_mem_num Process_Yyyymm

8 12 200502 8 12 200504

9 11 200501 9 11 200408

7 10 200504 7 10 200402 7 10 & nbsp; 200309

# Variable Type Len Pos Format Informat Label ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ ƒƒƒƒƒƒƒƒƒƒƒƒƒ 1 Adm_Key Num 8 0 Adm Key 2 Adm_Mem_Num Num 8 8 Adm Mem Num 3 Process_Yyyymm Num 8 32 Process Yyyymm

I need to know how many claims are in a single process year (regardless monthes) and how many in more than single year. Something like the following statistics based on the file above:

Just 2 admissions have claims in a single year (2005) 2 of them have claims in 2 different years (2005 & 2004) 3 of them have claims in more than 2 different years (2005 & 2004& 2003)

How can I produce this statistics??

Thank you in advance,

Irin

--------------------------------- 8:00? 8:25? 8:40? Find a flick in no time with theYahoo! Search movie showtime shortcut.

_____

Have a burning question? Go to Yahoo! <http://answers.yahoo.com/;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1 NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx> Answers and get answers from real people who know.


Back to: Top of message | Previous page | Main SAS-L page