Date: Thu, 7 Mar 2002 23:19:04 -0500
Reply-To: howard_schreier@ITA.DOC.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: howard_schreier@ITA.DOC.GOV
Subject: Re: help: cocatenatign unknown SAS data sets
A MERGE with no BY is usually suspicious.
Try copying the BY statement used in the PROC REG step and pasting it after
the MERGE statement.
On Thu, 7 Mar 2002 16:56:18 -0500, P. L <li_9@HOTMAIL.COM> wrote:
>>
>>%macro reg (year);
>>
>>data a;
>> set income.earning&year;
>>if tyr ne 98;
>>run;
>>
>>proc reg data = a outest =b (rename=(intercept=a yrcan=b));
>> by lage sex big5 degree lang warea;
>> weight numwith;
>> model diffcon = yrcan;
>>run;
>>
>>data table&YEAR;
>> merge a b (keep=a b);
>> c = abs(a/b);
>> if c = . then c = 0;
>>run;
>>
>>%mend;
>>
>>Kind regards,
>>
>>Dave
>>
>>.
>
>Dave,
>
>Thanks for your message. I've tried your code and it is indeed simpler and
>much faster than what I did before. However, I have some trouble with your
>program. As the following samples show, what I need is the same a b, c
>values for observations with the same combination. But, using your code
>produces diffirent values for observations of the same combination. I'm not
>sure why happens. If you would provide suggestion to fix the problem, it
>will be greatly appreciated.
>
>P. L
>
>THIS IS WHAT I
>WANT:
>
> Obs lyr tyr a b c
>
> 1 80 82 -23549.42 1666.51 14.1310
> 2 80 83 -23549.42 1666.51 14.1310
> 3 80 84 -23549.42 1666.51 14.1310
> 4 80 85 -23549.42 1666.51 14.1310
> 5 80 86 -23549.42 1666.51 14.1310
> 6 80 87 -23549.42 1666.51 14.1310
> 7 80 88 -23549.42 1666.51 14.1310
> 8 80 89 -23549.42 1666.51 14.1310
> 9 80 90 -23549.42 1666.51 14.1310
> 10 80 91 -23549.42 1666.51 14.1310
> 11 80 92 -23549.42 1666.51 14.1310
> 12 80 93 -23549.42 1666.51 14.1310
> 13 80 94 -23549.42 1666.51 14.1310
> 14 80 95 -23549.42 1666.51 14.1310
> 15 80 96 -23549.42 1666.51 14.1310
>
>THIS IS WHAT YOUR CODE PRODUCED:
>
> Obs lyr tyr a b c
>
> 1 80 82 -23522.68 1662.69 14.147
> 2 80 83 -47216.20 1132.72 41.684
> 3 80 84 -26497.64 0.00 0.000
> 4 80 85 -35823.65 1687.36 21.231
> 5 80 86 -44633.68 2609.90 17.102
> 6 80 87 -27862.22 147.74 188.590
> 7 80 88 -30085.42 331.21 90.835
> 8 80 89 -15052.34 -17.30 870.111
> 9 80 90 -19058.76 266.78 71.441
> 10 80 91 -16583.35 -288.29 57.523
> 11 80 92 -23158.46 39.82 581.556
> 12 80 93 -20230.82 -140.87 143.612
> 13 80 94 -21842.69 117.37 186.109
> 14 80 95 -23397.47 165.95 140.993
> 15 80 96 -19256.60 147.53 130.524
|