Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Converting a SAS datastep to Stata


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Converting a SAS datastep to Stata
Date   Tue, 14 Dec 2010 17:26:11 -0500

Daniel Feenberg <feenberg@nber.org> :
No Mata required; try out this example:

clear
range yr 1993 2010 18
mat x=(2350,2450,2500,2550,2650,2700,2750,2800,2900,3000,3050,3100,3200,3300,3400,3500)
g ex=x[1,yr-1992]
list

But it would be faster to do all the tax calculations in Mata, first
moving the data into Mata.  See also
http://www.stata-journal.com/sjpdf.html?articlenum=pr0017
on translating Fortran into Mata.

On Mon, Dec 13, 2010 at 7:51 PM, Daniel Feenberg <feenberg@nber.org> wrote:
> I have done programs to calculate income tax liability in SAS and fortran.
> Both those languages allow tax parameters that vary across years and filing
> status to be held in initialized arrays. For example, in SAS one could
> declare:
>
>   array exmp(1993:2010) _temporary_;
>   retain exmp 2350 2450 2500 2550 2650 2700 2750 2800 2900 3000 3050 3100
>               3200 3300 3400 3500;
>
> and then assigning the correct value of the personal exemption to every
> individual record is just:
>
>   exemption = exmp(fldpyr);
<snip>
> I don't actually know Mata, but I think I could define a rowvector:
>
>    exmp =  ( 2350 2450 2500 2550 2650 2700 2750 2800 2900 3000 3050 3100
>               3200 3300 3400 3500);

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index