Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: syntax question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: syntax question
Date   Tue, 19 Nov 2002 13:40:07 -0000

[email protected]
> 
> Hi Stata users, I'm now trying to convert SAS language to 
> Stata. Since I'm relatively new to Stata, any help will be 
> greatly appreciated!!!!
> 
> The SAS language I try to rewrite for Stata is
> 
> do i =1 to 6;   
> 
>    if (ICAT EQ i) then do;
> 
>       do j =1 to 4;     
> 
>             if (KiAj{j,1} > 0) and (KiGj{j,1} > 0) then do;
>             IGC{i}   =IGC{i}   + KiGj{j,1};
>             IGC_h{i} =IGC_h{i} + KiAj{j,1};
>             IHC{i}   =IHC{i}   + KiHj{j,1};
>          end;  
> 

What is SAS? Or more seriously, I don't know SAS, 
so I am guessing. 

do seems to map to -forvalues-. There is a tutorial 
on -forvalues- -- for which you need to know the 
rudiments of local macros -- at 
http://www.stata.com/support/meeting/8uk/fortitude.pdf

EQ presumably is a test for equality so that is ==. 

The main pitfall to be aware is the difference in Stata 
between the -if- command and the -if- qualifier. 

See http://www.stata.com/support/faqs/lang/ifqualifier.html

Nick 
[email protected] 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index