Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Dan Blanchette <dan.blanchette@duke.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: STATA equivalent SAS code |
Date | Fri, 9 Jul 2010 10:17:57 -0400 (EDT) |
Jose, I hope you know about my webpage: "A SAS User's Guide to Stata" http://faculty.fuqua.duke.edu/home/blanc004/data_programming/sas_to_stata/ Martin is right that Stata's -inlist()- is equivalent to SAS's in().In Stata's -inlist()- you have to put the variable being tested inside the parentheses which is not how SAS's in() works:
if varx in (value1,value2,value3) then ...some SAS code ...; would be: ..some Stata code... if inlist(varx,value1,value2,value3) There is not really a Stata equivalent to SAS's if-then-do programming style, but I have an example Stata do-file page that shows how you can come pretty close to doing that sort of programming in Stata: http://faculty.fuqua.duke.edu/home/blanc004/data_programming/stata/code/cond_fun.html HTH, Dan Blanchette Research Associate Center for Entrepreneurship and Innovation Duke University's Fuqua School of Business dan.blanchette@duke.edu
Date: Thu, 8 Jul 2010 23:30:05 +0200 From: "Martin Weiss" <martin.weiss1@gmx.de> Subject: st: RE: STATA equivalent SAS code <> I am not an SAS user myself, but you may want to look at -inlist()- HTH Martin - -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jose Benuzillo Sent: Donnerstag, 8. Juli 2010 23:26 To: statalist@hsphsun2.harvard.edu Subject: st: STATA equivalent SAS code Hi all, What is the Stata equivalent of the following SAS code? If varx in (value1,value2,value3) then do; Thanks - -jose
* * 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/