Using STATA 15.1 Windows 10
Hi All, firsttime poster.
I am attempting to replace a dummy variable (y_dummy) equal to 1 when...
Announcement
Collapse
No announcement yet.
130 results in 0.0136 seconds.
foreach
x
You can also choose from the popular tags.

Jim Steiner started a topic Replace dummy variable value when a variable has a numeric value somewhere in the list of all of another variable's valuesin GeneralReplace dummy variable value when a variable has a numeric value somewhere in the list of all of another variable's values
 3 posts

Labeling variables with a for loop
I have a bunch of serially placed variables: Q49_1_aQ49_104_h. I am trying to label them such that the labels become something like the following:...Last edited by Taz Raihan; 21 Sep 2018, 13:49.
 3 posts

Renaming variables with a for loop
Suppose I have 8 variables named: DY, DZ, EA, EB, EC, ED, EE, EF.
I want them to be renamed to the followings:
Apple_total_harvest...Last edited by Taz Raihan; 20 Sep 2018, 14:57.
 8 posts

Reshape long for many similarly labeled variables
I have list of ~2,000 variables that I am trying to reshape from wide to long. The variables are distinguished by three separate numbers clarified below...
 4 posts

macro within macro using foreach and forvals
Dear Statalist,
I would like to use a forvalues loop where one of the numerics are derived from a macro. In turn, that macro is itself derived...Last edited by Linus Andersson; 21 Aug 2018, 00:47.
 3 posts

Summing across variables
I have data with 160 countries and 6 sectors as variable names. I tried to use the foreach command to sum the six sectors of each country so I get 160...
 17 posts

Alexandre Loures started a topic Syntax to multiply the vector of the regressors by the estimated coefficient (omitted because of collinearity)in GeneralSyntax to multiply the vector of the regressors by the estimated coefficient (omitted because of collinearity)
I have the following syntax to multiply each vector (independent variable) by the coefficient of the estimation:
forvalues i = 1(1)103 {...
 2 posts

Computing bilateral flow using function
Dear all,
This is not a statistical question (I apologize) but one for a function.
I have data for origin and destination (data...
 7 posts

How to move the prefix as the suffix?
I would like to move the prefixes to the suffixes. For example, if a variable is called tx_abc, I would like to change it as "abc_tx". The "x"...
 6 posts

For Loop Syntax Error  Subsetting Data
Hello,
I have two datasets. I have a Maindata which I would like to split into around 40 datasets based on a criteria in a separate dataset....Last edited by Minnie Smith; 15 Jul 2018, 11:38.
 3 posts

For Loop Syntax Error
Hello,
I am trying to use a basic for loop but keep getting the error 'Invalid Syntax' which I cannot figure out. The variable id has been...
 3 posts

Categorising numerous variables with different ranges
Hi all,
I have a range of test results & need to categorise them as low, normal, high, according to their normal ranges. I am looking...
 5 posts

Local variables with mutiple loops
Hello everyone,
I am currently struggling with a foreach command. I would like to make several regression with different variables, where...
 3 posts

Foreach loop  egen function
At present, I need to generate a new variable for each value in the variable called "setting" (Int 112), which would be the sum of those values...Last edited by Tim Chambers NZ; 18 Jun 2018, 16:22.
 3 posts

Variable order loop
Hi all, I have a data set with 280 variables. All but ~35 of them are repeats of question of variables ordered by event. The event is numbered (event1,...
 4 posts