Quantcast
Channel: Statalist
Viewing all 65029 articles
Browse latest View live

Nlsur QUAIDS residuals

$
0
0
Dear Stata Users
How can I get the residuals of the Quaids model estimated by nlsur, to bootstrap them. The predic function gives me an error message. I can't estimate to extract the predicted values either.
This is script model



#delimit ;
nlsur ModeloT_2 @
W1
W2
W3
W4

lnP1
lnP2
lnP3
lnP4
lnP5

lnM

nmiem7
nmiem8
nmiem9
nmiem10
nmiem11
nmiem12
nmiem13


Errores

M1

sexosp_1
convivencia_1
estudredsp_2 estudredsp_3 estudredsp_4
ocusp_1

[pweight = peso],

ifgnls
neq(4)
param(a1 a2 a3 a4
b1 b2 b3 b4
g1_1 g1_2 g1_3 g1_4
g2_2 g2_3 g2_4
g3_3 g3_4
g4_4



l1 l2 l3 l4

d1_1 d1_2 d1_3 d1_4

d7_1 d7_2 d7_3 d7_4
d8_1 d8_2 d8_3 d8_4
d9_1 d9_2 d9_3 d9_4
d10_1 d10_2 d10_3 d10_4
d11_1 d11_2 d11_3 d11_4
d12_1 d12_2 d12_3 d12_4
d13_1 d13_2 d13_3 d13_4

D1_1
D2_1
D3_1
D4_1

SE_1 SE_2 SE_3 SE_4
CO_1 CO_2 CO_3 CO_4
ES2_1 ES2_2 ES2_3 ES2_4
ES3_1 ES3_2 ES3_3 ES3_4
ES4_1 ES4_2 ES4_3 ES4_4
OC_1 OC_2 OC_3 OC_4
)
nparameters(82)

title( PRIMERA ETAPA)
title2( 5 MACRO-GRUPOS DE GASTO)
nolog
noconstants
vce(robust)
a_0(`=a_0');



How to use Egen variable as a value in Panel data

$
0
0
Hi Stata Community,


I have a Panel data ( with xtset format) and I have created egen variable to estimate the mean of the CPI for each country over the period of 2021-2022 (monthly data ) as follows ;


egen avrInf = mean(CPI) if tin(2020m1,2022m12), by(code)


When I try to identify the list of countries that had CPI in 2023 above the calculated Egen ( 2021-2022) , the program display no results , as per the below ;


# This will not show any results (

list country CPI time if tin(2023m1,) & CPI > avrInf


# This will show the results for 2022 only ( and will ignore 2023)


list country CPI time if tin(2022m1,) & CPI > avrInf


Grateful for your support and any help .
B

Merging two datasets where "master" variable is within a range in "using" variable - ICD-O3

$
0
0
Good morning!

I have a dataset of cancer patients with 100,000 observations. The Master dataset has an ICD-O3 code for the type of cancer. The Using dataset (from SEER) has the Site codes and the Site Description. I want to merge the datasets so that the Site Description appears in the Master dataset. The challenge is that the Site Codes in the SEER data take the following form for several observations: “C000-C006,C008-C009”. I did split and reshape to end up with “C000-C006” and “C008-C009”, but can't figure out the next step.

I have looked at using joinby, cross, inrange but can’t find a solution yet. I'm using Stata/SE16.1 Examples of Master, Using and Results are below. Any suggestions will be appreciated.


MASTER dataset

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input byte PatientID str4 Cancer
 1 "C001"
 2 "C099"
 3 "C001"
 4 "C154"
 5 "C220"
 6 "C171"
 7 "C059"
 8 "C081"
 9 "C130"
10 "C001"
end
USING dataset
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str49 Siterecode str34 SiteDescription
"C000-C006,C008-C009"                               "LIP"                               
"C019"                                              "BASE OF TONGUE"                    
"C020-C024,C028-C029"                               "TONGUE (EXCL BASE OF TONGUE)"      
"C030-C031,C039-C041,C048-C052,C058-C062,C068-C069" "GUM, FLOOR OF MOUTH, & OTHER MOUTH"
"C079-C081,C088-C089"                               "SALIVARY GLAND"                    
"C090-C091,C098-C104,C108-C109"                     "OROPHARNYX"                        
"C110,C112-C113,C118-C119"                          "NASOPHARYNX (EXCL POSTERIOR WALL)" 
"C111"                                              "POSTERIOR WALL OF NASOPHARYNX"     
"C129-C132,C138-C139"                               "HYPOPHARYNX"                       
"C140,C142,C148"                                    "PHARYNX"                           
"C150-C155,C158-C159"                               "ESOPHAGUS"                         
"C160-C166,C168-C169"                               "STOMACH"                           
"C170-C173,C178-C179"                               "SMALL INTESTINE"                   
"C180, C182-C189, C199"                             "LARGE INTESTINE, (EXCL. APPENDIX)" 
"C181"                                              "APPENDIX"                          
"C209"                                              "RECTUM"                            
"C210-C212,C218"                                    "ANAL CANAL & ANUS"                 
"C220"                                              "LIVER"                             
"C221"                                              "INTRAHEPATIC BILE DUCTS"           
end

RESULT
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input byte PatientID str4 Site str34 SiteDescription
 1 "C001" "LIP"                               
 2 "C099" "OROPHARNYX"                        
 3 "C001" "LIP"                               
 4 "C154" "ESOPHAGUS"                         
 5 "C220" "LIVER"                             
 6 "C171" "SMALL INTESTINE"                   
 7 "C059" "GUM, FLOOR OF MOUTH, & OTHER MOUTH"
 8 "C081" "SALIVARY GLAND"                    
 9 "C130" "HYPOPHARYNX"                       
10 "C001" "LIP"                               
end



Using a loop to export excel files

$
0
0
Hi, everyone,

I have an excel spreadsheet with World Bank development indicators for the years 2003-2013. I'd like to create a loop that exports a separate spreadsheet for each year.

Here is a sample of my data:

Code:
input int year str52 reporterdesc str3 reporteriso str17(gdp_pc manuf industry)
2003 "Afghanistan"              "AFG" "200.462375926026"  "768258326.019014"  "1030958898.99678"
2003 "Albania"                  "ALB" "1846.12012081207"  "231427088.171808"  "1349879571.14245"
2003 "Algeria"                  "DZA" "2117.04822899287"  "27868320908.4311"  "33920483855.7025"
2003 "American Samoa"           "ASM" "9043.682366545279" "108000000"         ".."               
2003 "Andorra"                  "AND" "31954.1556558944"  "85391740.59167489" "365933968.43826"
This is my code:

Code:
* Import excel file
import excel using "intermediate_data/wb_dev_indic.xlsx", firstrow

* Create local macros for each year
local yr "03 04 05 06 07 08 09 10 11 12 13"

* Loop through each year and export a separate spreadsheet
foreach i in `yr' {
   
    export excel using "intermediate_data/wb_`yr'.xlsx" if year=="20`yr'", replace
   
}
I am currently getting a "type mismatch" error code r(109), but I'm not sure why.

The year variable in my spreadsheet is an integer, so perhaps I messed up the syntax and the loop is expecting a string?

Decluttering hbar graph

$
0
0
Hello and apologies for cross posing. I am looking to produce a hbar graph that displays the totals for each bar, however currently the graph is very cluttered. I would also like to enlarge the size of the bars. Below is an example of the data and my current code which produces the following graph. Any suggestions or advice would be greatly appreciated. Thank you!

Adam

Code:
graph hbar (sum) year1_energy_GWh, over(scenario_2) over(state_abbr_1, gap(*3)) asyvars legend(position(6)  rows(1)) blabel(total) ytitle("First Year FPV Generation (GWh)") title("FPV Estimates by Scenario in the Northeast")
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str2 state_abbr_1 str25 scenario_2 float year1_energy_GWh
"CT" "Open"                      1.2581414
"CT" "Biodiversity Conservation"  1.240995
"CT" "Open"                       1.234315
"CT" "Resilience"                2.3201365
"CT" "Biodiversity Conservation" 1.2387027
"CT" "Biodiversity Conservation" 1.2459012
"CT" "Resilience"                 1.253525
"CT" "Resilience"                11.332708
"CT" "Resilience"                 1.235578
"CT" "Biodiversity Conservation"  1.229009
"CT" "Open"                       1.237945
"CT" "Resilience"                1.2375426
"CT" "Open"                      1.4528956
"CT" "Biodiversity Conservation"  1.260093
"CT" "Resilience"                1.2383895
"CT" "Biodiversity Conservation" 1.2306623
"CT" "Biodiversity Conservation" 1.2306623
"CT" "Biodiversity Conservation" 1.2512425
"CT" "Biodiversity Conservation"  1.207899
"CT" "Precautionary/Co-Benefits"  4.556657
"CT" "Precautionary/Co-Benefits"  3.666552
"CT" "Biodiversity Conservation" 1.2791827
"CT" "Open"                        1.20909
"CT" "Precautionary/Co-Benefits"  31.46854
"CT" "Biodiversity Conservation" 16.580193
"CT" "Biodiversity Conservation" 1.6694952
"CT" "Open"                      1.2456912
"CT" "Open"                      1.2500556
"CT" "Biodiversity Conservation"  1.266009
"CT" "Open"                       1.261932
"CT" "Precautionary/Co-Benefits" 64.658875
"CT" "Precautionary/Co-Benefits"  9.433941
"CT" "Precautionary/Co-Benefits"  54.69945
"CT" "Resilience"                 8.145659
"CT" "Resilience"                 5.500001
"CT" "Precautionary/Co-Benefits" 1.2863942
"CT" "Biodiversity Conservation"  41.93174
"CT" "Open"                       5.133237
"CT" "Biodiversity Conservation"  1.257524
"CT" "Biodiversity Conservation" 1.2617728
"CT" "Biodiversity Conservation"  1.260093
"CT" "Open"                      1.2266812
"CT" "Open"                      1.2261162
"CT" "Precautionary/Co-Benefits"  6.246189
"CT" "Open"                      1.2129014
"CT" "Open"                      1.2263212
"CT" "Biodiversity Conservation"  1.266009
"CT" "Open"                       5.750137
"CT" "Precautionary/Co-Benefits" 1.5864046
"CT" "Resilience"                1.2485183
"CT" "Open"                      1.2446864
"CT" "Open"                      1.2594215
"CT" "Precautionary/Co-Benefits"  2.466801
"CT" "Biodiversity Conservation"   1.24085
"CT" "Biodiversity Conservation" 3.9789596
"CT" "Precautionary/Co-Benefits"  3.081274
"CT" "Resilience"                1.2577695
"CT" "Open"                      3.6380885
"CT" "Biodiversity Conservation" 1.2695323
"CT" "Biodiversity Conservation" 1.2384125
"CT" "Open"                      1.2284822
"CT" "Biodiversity Conservation"     1.242
"CT" "Biodiversity Conservation"  54.82994
"CT" "Open"                       9.574749
"CT" "Open"                      1.2551342
"CT" "Open"                      1.2465488
"CT" "Biodiversity Conservation"  4.323983
"CT" "Biodiversity Conservation"  1.229009
"CT" "Open"                      1.7733105
"CT" "Resilience"                1.2450868
"CT" "Resilience"                1.2532253
"CT" "Biodiversity Conservation" 1.2573873
"CT" "Biodiversity Conservation"  4.252918
"CT" "Precautionary/Co-Benefits"  9.346328
"CT" "Biodiversity Conservation" 1.2554654
"CT" "Biodiversity Conservation"  1.249973
"CT" "Biodiversity Conservation"   1.20978
"CT" "Biodiversity Conservation" 1.2358438
"CT" "Precautionary/Co-Benefits" 2.9427836
"CT" "Biodiversity Conservation"  5.171657
"CT" "Resilience"                1.6790197
"CT" "Resilience"                2.3656929
"CT" "Open"                       1.214149
"CT" "Resilience"                 1.255452
"CT" "Biodiversity Conservation" 2.2831388
"CT" "Biodiversity Conservation" 12.151608
"CT" "Biodiversity Conservation" 1.6474732
"CT" "Resilience"                1.2368176
"CT" "Resilience"                 1.218013
"CT" "Precautionary/Co-Benefits" 15.585084
"CT" "Precautionary/Co-Benefits" 1.2568663
"CT" "Biodiversity Conservation" 1.2671353
"CT" "Precautionary/Co-Benefits"  1.975887
"CT" "Open"                       1.236581
"CT" "Biodiversity Conservation"  1.267726
"CT" "Open"                      1.6308695
"CT" "Open"                      1.2263212
"CT" "Open"                       13.56239
"CT" "Biodiversity Conservation" 1.2554654
"CT" "Resilience"                 2.854018
end

Array

csdid2 w/controls doesn't affect coefficients

$
0
0
I have some csdid code. Adding dummy controls leaves the coefficients and absolutely unchanged.


Why?

Is it merely that the controls are entirely uncorrelated with the event? pwcorr says that this is very much not the case.

The two lines of code that produce the identical output are:

Code:
csdid cbirths, time(birthyr) ivar(countynhg) gvar(dtcsl) notyet  agg(event) cluster(stateicp)
Code:
csdid cbirths clr con, time(birthyr) ivar(countynhg) gvar(dtcsl) notyet  agg(event) cluster(stateicp)
(Yes I know that csdid2 is faster. Yes I get the same outcome with both csdid and csdid2)

Adding more years in Panel

$
0
0
Dear Statalist Users,

I would like to add more years in my dataset. I have used "fillin" command but it did not work.

I hope you can help me.

I have 81 cities and I observe each city in each year from 2003 to 2018 once. Each city has a unique identifier (i.e., variable plate). The variable plate ranges from 1 to 81. For example 1 denotes city "Adana". As you can see from the example data, I observe Adana (i.e., plate 1) in 2003, 2004, 2005,.., 2018. However, I need to add more years: 1998, 1999, 2000, 2001, and 2002. In the end, for example, I would like to observe city Adana (plate 1) in 1998, 1999, 2000, ..., 2018.

Thank you very much in advance.






Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte plate str15 city int child_birth_year float z_refugee_share
1 "Adana"    2003 -.16672547
1 "Adana"    2004 -.16672547
1 "Adana"    2005 -.16672547
1 "Adana"    2006 -.16672547
1 "Adana"    2007 -.16672547
1 "Adana"    2008 -.16672547
1 "Adana"    2009 -.16672547
1 "Adana"    2010 -.16672547
1 "Adana"    2011 -.16672547
1 "Adana"    2012 -.16672547
1 "Adana"    2013 -.02810832
1 "Adana"    2014   .2721727
1 "Adana"    2015   .8131932
1 "Adana"    2016   .9066704
1 "Adana"    2017   .9490147
1 "Adana"    2018  1.2135105
2 "Adiyaman" 2003 -.16672547
2 "Adiyaman" 2004 -.16672547
2 "Adiyaman" 2005 -.16672547
2 "Adiyaman" 2006 -.16672547
2 "Adiyaman" 2007 -.16672547
2 "Adiyaman" 2008 -.16672547
2 "Adiyaman" 2009 -.16672547
2 "Adiyaman" 2010 -.16672547
2 "Adiyaman" 2011 -.16672547
2 "Adiyaman" 2012 -.16672547
2 "Adiyaman" 2013  .09111027
2 "Adiyaman" 2014   .6769764
2 "Adiyaman" 2015  .39182165
2 "Adiyaman" 2016   .4605239
2 "Adiyaman" 2017   .4996558
2 "Adiyaman" 2018   .5800445
3 "Afyon"    2003 -.16672547
3 "Afyon"    2004 -.16672547
3 "Afyon"    2005 -.16672547
3 "Afyon"    2006 -.16672547
3 "Afyon"    2007 -.16672547
3 "Afyon"    2008 -.16672547
3 "Afyon"    2009 -.16672547
3 "Afyon"    2010 -.16672547
3 "Afyon"    2011 -.16672547
3 "Afyon"    2012 -.16672547
3 "Afyon"    2013 -.16672547
3 "Afyon"    2014 -.15601103
3 "Afyon"    2015 -.10584597
3 "Afyon"    2016 -.07713125
3 "Afyon"    2017 -.06103815
3 "Afyon"    2018 -.03937353
4 "Agri"     2003 -.16672547
4 "Agri"     2004 -.16672547
4 "Agri"     2005 -.16672547
4 "Agri"     2006 -.16672547
4 "Agri"     2007 -.16672547
4 "Agri"     2008 -.16672547
4 "Agri"     2009 -.16672547
4 "Agri"     2010 -.16672547
4 "Agri"     2011 -.16672547
4 "Agri"     2012 -.16672547
4 "Agri"     2013 -.16672547
4 "Agri"     2014 -.16396767
4 "Agri"     2015 -.14477333
4 "Agri"     2016 -.14309107
4 "Agri"     2017 -.13892677
4 "Agri"     2018  -.1353968
5 "Amasya"   2003 -.16672547
5 "Amasya"   2004 -.16672547
5 "Amasya"   2005 -.16672547
5 "Amasya"   2006 -.16672547
5 "Amasya"   2007 -.16672547
5 "Amasya"   2008 -.16672547
5 "Amasya"   2009 -.16672547
5 "Amasya"   2010 -.16672547
5 "Amasya"   2011 -.16672547
5 "Amasya"   2012 -.16672547
5 "Amasya"   2013 -.16672547
5 "Amasya"   2014 -.16226056
5 "Amasya"   2015   -.160296
5 "Amasya"   2016  -.1570366
5 "Amasya"   2017  -.1487765
5 "Amasya"   2018 -.14127544
6 "Ankara"   2003 -.16672547
6 "Ankara"   2004 -.16672547
6 "Ankara"   2005 -.16672547
6 "Ankara"   2006 -.16672547
6 "Ankara"   2007 -.16672547
6 "Ankara"   2008 -.16672547
6 "Ankara"   2009 -.16672547
6 "Ankara"   2010 -.16672547
6 "Ankara"   2011 -.16672547
6 "Ankara"   2012 -.16672547
6 "Ankara"   2013 -.16672547
6 "Ankara"   2014  -.0727472
6 "Ankara"   2015  .00234771
6 "Ankara"   2016  .04360104
6 "Ankara"   2017  .08465073
6 "Ankara"   2018  .13453442
7 "Antalya"  2003 -.16672547
7 "Antalya"  2004 -.16672547
7 "Antalya"  2005 -.16672547
7 "Antalya"  2006 -.16672547
end



Finding Median, IQR and Associated p-values in Complex Survey Design

$
0
0
Hi Statalist members,

I am a graduate student using Stata. My professors use R or SAS (which I have no clue about but hope to learn later) so they can't help much with my Stata questions).
I am currently using the NHANES data - a complex survey design - to compare several variables across quintiles of an exposure variable e.g. to compare the distribution of age across quintiles of sleep duration. However, all of the variables are not normally distributed, thus I am more inclined to report the numbers using median (interquartile range), instead of mean ± standard deviation. How can I get the median but also check for statistical significance?

If I use the epctile code below (user-written code by Stas Kolenikov) I get the Median but only with a Confidence Interval (not the Interquartile Range and an overall p-value). However, an arduous way to get IQR would be to run the same code separately for p(25) and p(75) from which I can calculate the IQR for each age category but still doesn't tell me about the overall statistical significance of age across all the categories (please see below).
Is there a more efficient way to run this as a single code to get the Median and IQR, while also getting a single p-value like I would with Mean?
I'd appreciate anyone's help with this, please. Thank you!


Array

Doubt about a stata question

$
0
0
Hi there! I have a homework and I don't know how to solve this question. I have to calculate the percentage of people who have private insurance over the total (private insurance + public insurance) by quintiles and by age group. I have the variable "isapre" which is a dummy that takes the value 1 if the person has private insurance and 0 if not. I have the variable "quintiles" that I obtained from the xtile function from the variable "ypc_1", and four age groups: under 18 years old (minor_18), between 18 and 39 (between18_39), between 40 and 64 (between40_60) and over 65 (greater_65 ). I have the following stata output that I need to get to but I can't find the command. Could someone tell me how to get this command?

SVYSET for pretest and posttest survey

$
0
0
Dear Sir/Madam,

I am writing to seek your guidance on an issue I've encountered regarding SVYSET and weighting.

I have successfully merged the pretest and posttest datasets, where the pretest dataset has 13,336 samples and the posttest dataset has 2000 samples. Each dataset comes with its respective weight variable - "weight" for the pretest and "weight_r2" for the posttest.

To conduct survey-weighted analyses, I have set up the SVYSET as follows:
  1. For pretest: svyset unique_draw [pw=weight], strata(stratum44)
  2. For posttest: svyset unique_draw [pw=weight_r2], strata(stratum44)
However, when performing t-tests or regressions using SVYSET on variables like "hhmem" (pretest household size) and "b1" (posttest household size), I have observed that both variables seem to adopt the SVYSET of the posttest, rather than adhering to their respective SVYSET specifications.

I would greatly appreciate your insights on how to address this issue. Specifically, I am seeking guidance on how to ensure that each variable follows its designated SVYSET specifications, given the unique weighting for each dataset.

Your expertise in this matter would be invaluable, and I am grateful for any assistance you can provide. Thank you very much for your time and consideration.


Thanking you

SaveMat and SaveTable

$
0
0
Good evening!

I am editing some code from a previous analysis and came across the following code: preserve
table vaccine vx_covcat [pweight=vx_wgt], replace
SaveTable
drop stat
for X in var table0 table1 table2 table3 table10 table11 table12 \ Y in any "NoVax" "MotherReport" "Unknown" "NotYetDue" "EarlyTimely" "Late" "Indeterminable": ren X Y
outsheet using Table1_VaxSummmary.out, replace
restore

When I run the code, the following error occurs: variable table* not found
(error in option exclude())

However, earlier in the do-file those code (SaveMat results Table1_Freqs) ran with no errors. I have never seen this code used before and couldn't find any literature on it so just wanted to ask if anyone else was familiar with it and would know what I could do to solve the error?

when untreated observations are les than Treated observation: Endogenous Switiching Regression

$
0
0
Dear Statalist,
Is it okay to go ahead with ESR (Endogenous Switching Regression) when untreated observations are less than Treated observations? Or will such a sample size affect the ESR results particularly the MTE (marginal treatment effect) on TU or avg treated on Untreated? Data may be assumed as one year survey data.
Please try to give your suggestions.
Thank you.

Can we use weights or do svy for didregress?

$
0
0
Dear all,

I have svyset. I am trying to run:

Code:
didregress (wjnilf  i.racecat i.sex age c.age#c.age i.educat fullpart incwage) (treat14), group(statefips) time(year) aggregate(dlang)
wjnilf is binary. I am also doing a probit and glm logit. However, I also want to run a didregress. However, unlike probit and logit, I can't svy didregress. How can I use weights in did? Thanks.

How to type Greek letters with putdocx command?

$
0
0
Dear Statalisters, I know that we can put Greek Letters in Stata Graphs (in titles etc.) using something like {\&Alpha}. But I am unable to figure out if we can also put Greek Letters (and may be other Mathematics symbols) within .docx files created using the -putdocx- command. Is it doable?

Requesting help on renaming variables

$
0
0
Hello,
I reshaped a long-format dataset to a wide format. The Stata command has automatically added the follow-up number at the end of each new variable. I used foreach loop to add a pre-fix as Q1, Q2, Q3 for each created follow-up variable. I now need to remove the follow-up number added by Stata (last digit of each variable). However, I am uncertain how to do it, for example, I cannot use rename *3 * command to rename follow-up 3 variables after renaming follow-up 1 and 2. I would very much appreciate your help.

See some of my variables below.

Follow up 1 (Q1) Q1_S4d_1_11 Q1_S4d_1_21 Q1_S4d_1_31 Q1_S4d_1_41 Q1_S4d_1_51 Q1_S4d_1_61


Follow up 2 (Q2) Q2_S4d_1_12 Q2_S4d_1_22 Q2_S4d_1_32 Q2_S4d_1_42 Q2_S4d_1_52 Q2_S4d_1_62


Follow up 3 (Q3) Q3_S4d_1_13 Q3_S4d_1_23 Q3_S4d_1_33 Q3_S4d_1_43 Q3_S4d_1_53 Q3_S4d_1_63

I look forward to receiving your insights.

Thank you.

Dham

"coefplot" for multiple regression coefficients

$
0
0
Hi, I am using a 2SLS FE regression model. With different model specifications I want to plot 2nd stage regression coefficient for only one variable to see how it bahaves.

I am using the following loop:

gen x1=0
local w "gds inv_oda_shareGDPAVN fdi_netinf_gdpwdi L.gTFP_pwt L.gWm_215A irr unctad_pci bgtdef pol_stab i.d_year*"
local y "x1 gTFP_pwt gWm_215A irr unctad_pci bgtdef pol_stab i.d_year*"
local i=1

forvalues x=1(1)6 {
quietly xtreg gKm2 `w' if world_region==`x', fe cluster(id)
predict temp
replace x1= temp if world_region==`x'
drop temp
quietly xtreg gLm_215A `y' if world_region==`x', fe cluster(id)
estimates store m`i'

}


coefplot (m1, label(m1)) (m2, label(m2)) (m3, label(m3)) (m4, label(m4)) (m5, label(m5)) (m6, label(m6)) ///
, keep(x1) xline(0)

BUT when I plot the coefficients it says m2 is not found. Indeed instead of six estimates, it saves only the first one. Am I missing something in my syntax. Will be grateful for advice please?

Convert time variable (09mar2020 13:01:54) into a categorical variable or into groups

$
0
0
Hi!
I run STATA 17 on a Mac. I have a dataset with 826 observations and around 1,089 variables.

One of the variables is the time they submitted a form at the clinic "f_submittime", and the data looks like this: "09mar2020 13:01:54". The type is "float" if that helps.
I want to find a way to just divide all observations into two groups depending on if it was before or after 12.00, no matter what the date was.
How can I convert this variable into something that I can use to create a new binary variable that is "time after 12" y/n.
I have searched, but have not been able to find the answer.

I would appreciate very much if someone could help me!

dtable and ranksum test

$
0
0
Dear Listers

I havent work much with stat 18 yet, but have tried to make a dtable using median, and want to test between group differences using ranksum test.

Code:
dtable var1 var2 var3, continuous(var1 var2 var3, stat(p5 p50 p95)) by(group)
how do i include the ranksum test into that?

Thank you
Lars

Update Nov,. 15th: Can't export anyport

$
0
0
Hi,
after updating to the last version of Stata 18 on Mac, I can't export anymore, not to Excel, SPSS... I get the error message:

Error writing observation : 1
r(680);

But that's not really helpful.
Is it possible to reset Stata to pre-update version?

Thanks
Nick

teffects psmatch: matches?

$
0
0
Hi,

I am using propensity score matching to try and estimate the effect of participating in a labour market policy program on wage.

When using the command teffects psmatch (y) (treatment x1 x2 x3), atet gen(match) I am requesting 1 to 1 matches. However, I get min-values = 21 and max-values = 2210. How do I interpret this? Does this mean I don't got any 1 to 1 matches?

All the best,
Molly
Viewing all 65029 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>