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: STATA equivalent SAS code

From   Dan Blanchette <>
To   "" <>
Subject   st: RE: STATA equivalent SAS code
Date   Fri, 9 Jul 2010 10:17:57 -0400 (EDT)


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()-


- -----Original Message-----
[] On Behalf Of Jose Benuzillo
Sent: Donnerstag, 8. Juli 2010 23:26
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;
- -jose
*   For searches and help try:

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