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: Creating a dummy dataset in Stata


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: Creating a dummy dataset in Stata
Date   Mon, 08 Jul 2013 10:23:59 -0400

I'm not sure how a 95%CI can be 1 variable, so I will assume you mean 2 variables, the lower and upper bounds.

If you want to be sure your RRs look like RRs:

*---------------------------*
clear
set obs 66
gen ID=_n
gen p=0.5*runiform()+0.25
gen RR=p/(1-p)
gen CIw=RR*runiform()*0.25
gen lowerRR=RR-CIw
gen upperRR=RR+CIw
gen group=ceil(ID/3)
*---------------------------*

hth,
Jeph



On 7/8/2013 9:50 AM, Amal Khanolkar wrote:
Hi,

I would like to create a dummy dataset in Stata. Say I would like to have a dataset with 4 variables as follows:


1. ID
2. Relative risks
3. Corresponding 95% CI's for RRs
4. A group variable that groups 3 RRs together consecutively from top to bottom.

I know I have 66 IDs and 66 RRs and thus 22 groups (three RRs in each group).

I start with setting the number of observations to 66:

set obs 66

I now have no idea how to enter the RR, 95% CI and the group number for each observation.

Any tips?

Thanks ahead,



/Amal
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index