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, is already up and running.

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

st: RE: RE: STATA equivalent SAS code

From   Jose Benuzillo <>
To   "" <>
Subject   st: RE: RE: STATA equivalent SAS code
Date   Fri, 9 Jul 2010 09:53:54 -0600


Thanks for making me aware of this site. I program in SAS but my boss is more comfortable in STATA so this site will serve me well to quickly adapt my SAS code

From: [] On Behalf Of Dan Blanchette []
Sent: Friday, July 09, 2010 8:17 AM
Subject: st: RE: STATA equivalent SAS code


I hope you know about my webpage:
  "A SAS User's Guide 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:


Dan Blanchette
Research Associate
Center for Entrepreneurship and Innovation
Duke University's Fuqua School of Business

> Date: Thu, 8 Jul 2010 23:30:05 +0200
> From: "Martin Weiss" <>
> Subject: st: RE: STATA equivalent SAS code
> <>
> I am not an SAS user myself, but you may want to look at -inlist()-
> Martin
> - -----Original Message-----
> From:
> [] On Behalf Of Jose Benuzillo
> Sent: Donnerstag, 8. Juli 2010 23:26
> To:
> 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:

*   For searches and help try:

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