Second, While is true you have observations on all your variables, there is nothing that says that the information is complete for each observation. For example, in you regression you might have observations with information on variable PEE1 and completely different observations with information on PPE2. Since there is no common ground for all, Stata assumes there are no observations with common information available to run a regression. HTH Fernando.
Comment Post Cancel. Nick Cox. The error code may mean that one or more of your variables is string when numeric variables are needed. Here the problem is more likely to be that your data contain missing values. What's crucial is whether all variables specified are all non-missing in at least some observations.
The evidence implies No. Try Code:. Apologies for using my student number as my username, I have sent a request to Admin to change it to my name. Thank you for answers to my question. I want a single set of results for presentation purposes. Apart from running 5 different regressions - is there any way to run the regression taking this into account?
Nick: none of the variables are string - there are numerous missing values throughout the data. Is there any way to factor that in to the regression? How do I take the panel structure into account with my regression? You can't do regression with data in that form, as Stata is already telling you.
What's more likely to work is that you combine variables Code:. Joe Canner. For a simple linear regression, the only solution is either to impute something for the missing values or to use only one of the five variables PPE1-PPE5 at a time. I doubt if the latter is what you want, though.
Hey Stata man, I have a panel data with "ethnicity" coded for only one year of the individual id but missing for the other 3 years.
How do I fill in the missing values with the observed value for ethnicity? Hi Stata man!!!! I am working on a document for the central bank of Colombia. I am trying to estimate the following model:. Victoria, to run fixed effects you must specify which variable has the group code for the groups you want to run fixed effects for. This can be done in two ways. Suppose is a country code it should be numeric. Directly, with an i. Indirectly, by specifying the panel's structure.
It's pretty simple. Try running: xi: xtpcse endcp1 vario crec tam end1 z pi diftasa pib z2 i. Thanks for answer!! I tried to estimate the model again with your recommendation but I get another error:.
You have the following alternatives: 1. Drop some variables; see help drop. Well, it looks like you have too many categories in your fixed effects total possible values in the nit and ao variables is too high.
This poses a computational problem for Stata. As for a solution, I am not familiar with the command you are using, neither am I familiar with the dataset and the econometric model. If your data is truly a panel, maybe nit or ao are the variables that define the group? Try to use xtset to define the dataset as a panel and get rid of the explicit use of the i.
Sorry I can't help more. Hi Stataman, I am working on panel data with missing observations. When I declare the dataset as panel data using xtset, the data is decribed as strongly balanced which should not be the case. Secondly I'm trying to fill in the missing data by using tsfill, full command but nothing really is happening the missing data is not filled. Please suggest! Sorry, Eric. I can't really tell why it says it's balanced without seeing the data. My guess is that your missing values are not in the variables that contain the group and individual code.
But then again, that's just a guess. Never used tsfill before. Hi Stataman, Thanks! You are right and I realised that I dont require to use tsfill. So, you'll probably think this is a ridiculous question, but I haven't been able to input data. I downloaded. The file ran and the variables appeared, but when I went to data editor, the variables were listed, but no values. I also tried to use tabulate but it said no observations.
Help please! Hey StataMan I must say thank you for the Guide. But i have this task at hand - i have two datasets panel Data where data set is a follow up survey. So what i want to do is only select the HouseHolds HH in data set that are also in dataset.
The unique variable is HH id. Which is the best way around this assignment? Hi Kristine, Sorry for the delay. I had some personal stuff to attend to. The second command will take each household and give it the maximum of the in variable, which is 1 if this household has an observation in or 0 if there is no observation in Finally, the last command will keep the observations of households that also appear in I hope this helps.
I was wondering if I have unstandardized data on tourism , how can I normalize it by population? I want to make a graph that is number of dyads cumulative by tourist arrivals so it reflects a power log Thanks! Sorry, Victoria, but I don't think I can help without knowing what does the data look like. It sounds like your question is less about Stata and more about the analysis at hand. I'm sorry, but I don't think I can help you with that. Good luck! Thanks Stata Man What I want is a graph where x is 1, 2, 3, etc or 5, 10, 15 - something to that effect.
It's a bit hard without knowing how the original dataset looks like. You say that every dyad appears several times hence "number of observations" on the x-axis. If this is the case, you probably want to collapse the dataset so that every dyad will be one observation and you will create a new variable with the number of observations this dyad had in the original dataset. In addition you get some y variable tourist flow percentage. I'm not sure how this y variable appears in the original dataset.
Suppose you have it for each observation in the original dataset and you want to present the mean y mean tourist flow percentage So if this is how your original dataset looks like every dyad appears several times, with some y-variable for each observation. If not, I hope this gives you a hint at what you're aiming to.
Sorry I can't help more, Roy. Hey stataman! I have a noob question concerning the estimation of a random effects model xtreg re. I hope you can help me: I have run the random effects model and accordingly a fixed effects model.
Afterwords I performed a hausman test which was insignificant confirming that my data allows to be estimated with random effects I also confirmed this with the Breusch-Pagan Lagrange multiplier test for random effects.
I am now testing the assumptions for my model, but I am unsure about all the assumptions that should be tested. For now I have tested my models for collinearity collin , heteroscedasticity lrtest and autocorrelation xtserial. I am however unsure whether I have to test for other assumptions? Maybe you have a clue.
Kind regards David. Hi David, Hmmm I'm not sure what to say. It's very hard to run tests without knowing what are your maintained assumptions. Moreover "testing assumptions" is something that you can't do without maintaining others. For example, testing for endogeneity of some variables requires you to assume that the instrumental variables you use are exogenous which you can't test, but In other words, if it's something that you can check, it's not really an assumption.
It is more of a result. This is an econometrics question and not a Stata question. This model, and your understanding of the data, should give you ideas about what assumptions are required for you to test your hypotheses using the data at hand.
It might be just my take on it or my econometrics professors' and others will think that you can test hypotheses or assumptions if you insist without thinking about the mechanism or a model. I'm sorry I can't help you more on this. Hi stataman!
How do I know if the runs test has a autocorrelation? Hello Stataman, I am running some data and applying kmeans cluster.
I got 3 different groups. My furter step is to apply a fuzzy c-means cluster and get the degree of membership of each observation to each fuzzy cluster, but I do know how to get it.
Please, could you help me? Thanks in advance. Hey stata man! First I used xtreg and results was ok. Second I'm tring to use xtabond but stata said: no observations r Please help me. Hi stataman Thanks for your BLOG. Good reading. I've been having trouble with a command and was hoping you might be able to help.
Quite simply, all I want to be able to is rename var1, var2, var3, Good question, daticon, and the answer lies in the nature of macros locals or globals. After all macros have been substituted by their content, then the command will run as if there weren't any macros used at all.
In this case a variable's name. Commands that take one value like di, for example instead of whole variables like corr, reg, su, and so on , will take the first row of the variable unless you add the row number in brackets after the variable's name.
This is why you're getting the value of var1 which you set to be the name. Generally speaking, putting the variable's name as the observation is not a very good strategy.
It's usually an outcome of a flawed data import there's a way to tell insheet to treat the first row as variable names, look at the help file. Otherwise, all the variables become strings and you probably don't want that. Thanks for the reply stataman. Yes, the problem is that I have to 'import' data from web-based tables that all have different column headings. The issue is compounded by the fact that the leading 0 or 0s get dropped on import, but which are vital to maintain, column headings are not STATA friendly, etc.
I have used a similar technique to your suggestion that basically involves importing the data by cutting and pasting into the data editor into STATA 11 two times. On the first run I treat the first row of data as an observation, so that the leading 0's don't drop. On the second run I treat the first row as headings. Then it is matter of having to click each heading to get the list of variables like in your example.
Of course, this takes a lot of time! And is tedious. The only way around is to find a programmatic way. Unfortunately, neither of our efforts yets solves it so that I only have to import the data once Would be so easy to accomplish in Java, C, etc. If you or any of your readers can think of an answer Thanks again, daticon. Save your file, import it to Stata, and fix the value of the first line that you changed take the character away.
I wish it would Unfortunately, the only 'fix' that will save me time is the ability to paste once into STATA and then rename all the column headers var1 - var n to the contents of the first row. Many thanks stataman for your help! That will save me loads of time. Hi Stata man, I'm trying to conduct a negative binomial regression. With the emphasis on trying! I get stuck before even running it When I enter the syntax or via the tabs above I get: number of dependent variables for equation 1 must be greater than zero.
This, while I most certainly did select a dependent variable! I cannot find out what that means beyond what it litteraly says and how to solve it. I can conduct, for example, a linear regression, create graphs so i dont think that its a data-import problem. And yes, Im new to stata or negative binomial regression for that matter: I hope you can help me Sincerely yours, Paul de Boer. Hi, stata man, I have a question that I can't solve. I've got panel data of company stocks and their month-end prices.
The data set is in a vertical form. For each year, I'm trying to calculate each stock's average monthly return based on the change in stock price from Dec 31, 20x1 and Dec 31, 20x2. I can't figure out how to do this in Stata but I'm guessing its in relative observations values.
I appreciate your help. Hi Stataman, First of all, thanks a lot for this very useful blog! I have some troubles performing a unit root test for an unbalanced panel with xtunitroot and would appreciate your help. My original variable is numeric and log-transformed "logsalesperemp". I tried to run a unit root test fisher pperron using the following command but got the error "r no observations". Note that I tsset the data before running the program and also tried with ips test but no panel was used and no result returned Have you already encountered this error with xtunitroot?
Any idea where the problem comes from? Thank you. Is there a command in Stata that solves heteroskedasticity and autocorrelation problems for binary dependent variable models in panel data? Thank you for reading this Woody: Tell us more about what sort of model are you using. It's not obvious to me since your dependent variable is binary. I am tring to model the determinants of implementation of clean tech based on several firm caracteristics.
As such, my dependend variable is structured as follows: 1 indicates the presence of clean tech in firm i, and 0 indicates no clean tech is present in the firm. Woody: Are you trying to use OLS regression or logistic regression? Logit is for categorical dependent variables like you have. Don't think you can properly use OLS regression with a binary dependent variable.
Woody: Now that I know that you are using a model with the usual linear assumptions, back to your original question. A stats program can't automatically fix problems of heteroskedasticity and autocorrelation. Solutions come from the human. Heteroskedasticity can mean that you have a missing variable in your model or your data set comes from different populations. In the first case, you add the missing explanatory variable to your model if you can identify it. In the second case, you can split your data into two or more data sets and run your model separately on each set.
Regarding the problem of autocorrelation, it seems to me that you have cross-sectional data rather then time-series so I'm not clear on why you have an autocorrelation problem in your logit model.
Please advise me what should I do. Thanks a lot! Hi, nice guide. That is, if your variable name is, say, "amount", then: destring amount, replace force. Thx it does work, could i tell him to replace the missings as. But ok i can rename them later easily. I get a "no observations" error message -r when I gave the following command and had the shown output : probit bio09 emagri08 exrate08 upov08 but When I gave the following command and had the shown output : probit bio09 emagri08 upov08, I can get result.
Do you have some solutions? Kyoko: Stata is reading exrate08 as a string variable meaning that it is reading the field as non-numeric. Functions like -probit- need numeric data to run. That's why you get the "no observations" error. Stata doesn't see any numeric data in that field. As a first step to solve this problem, I suggest that you look at the data in this field to see what characters or entries are being interpreted as non-numeric.
You could have alpha characters in this field. But I'd suggest that you understand what's causing Stata to read the field as string data before using -destring-. Michael, Thank you very much for your answer. I'll try at the university on next Monday. Michael, There are data-brank enterd ".. Thank you for your kindness. Yeah i though about something like that, but my problem is that i have many. So out of my and something observations i can only use around Is it possible to change that command so it considers that variables y,x, and z are not a missing value?
Policy Contact. Bookstore Stata Journal Stata News. Contact us Hours of operation. Advanced search. Users often find that Stata is reading in most, or even all, variables as string variables, when most, or even all, are—or should be—numeric.
If a variable is string, then typically Stata refuses to do calculations. A command such as tabulate will also list numeric values in alphanumeric order, rather than numeric, so that 1 , 11 , and 2 appear in that order.
One common reason for this problem is that the data have been imported from a spreadsheet or something similar. Some users of Excel or similar programs get in the habit of putting several lines of header material before the body of their data. Although Stata tries to detect such lines, it is not always successful, and this may have caused each variable to be treated as string.
0コメント