Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Converting a SAS datastep to Stata


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Converting a SAS datastep to Stata
Date   Tue, 14 Dec 2010 17:26:11 -0500

Daniel Feenberg <[email protected]> :
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 <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index