Hi,
I am working on a requirement, which goes like this :
Input File 1
----------------
name sex age
******* *** ***
ADAMS M 20
BAKER F 19
DOUGLAS M 19
HALE M 21
JONE F 19
LARUE F 18
NICK M 19
OLA M 22
PEBBLE F 22
RAINES F 21
Input File 2
----------------
AGE DESCRIPTION
***** ******************
19 nineteen years old
20 twenty years old
21 twenty one years old
22 twenty two years old
23 twenty three years old
24 twenty four years old
25 twenty five years old
I sort both the files on AGE, and I want the o.p to be
AGE TOTAL NUMBER OF PEOPLE IN THAT AGE DESCRIPTION
19 2 nineteen years old
I want to know how I do this.
My logic is to
1. read the first record in SAS. Have the count variable set as 0.
2. store the AGE in a temp variable. And have count variable set as 1.
3. Read the next record, and get the AGE.
4. Compare the temp value and the AGE.
If both are same : count + 1
If the age > temp, then
write a record into the o.p file -
Do the same until end of file.
I am quite new to SAS, so I am not able to find out how I can accomplish this in SAS. Any help or any guidance in this regard would be very helpful....
Thanks.
Murali.