Hello everyone. I am new to Stata. I need your help for a short question.
I have a dataset, and I hope to write a loop that counts from a value I set, say, 300, to the total number of observation. This is my code:
import excel "data/xyz.xlsx", firstrow case(lower) clear
sca start_obs = 300
foreach i = start_obs/`r(N)'{
display `i'
}
However, I got error message repetatedy "invalid syntax". How may I write the loop to make it work?
I appreciate your help!!
Related Posts with forval with a variable
appropriately deleting dummy 1sHi, I got a bit of a puzzle problem for one specific application, but I feel an appropriate solutio…
Coding linear time trend with missing yearsI am familiar with creating linear time trends. For example, if I have study years 1996, 1997, 1998 …
🙋 How to display full matrix names?This Code: clear all version 15.1 matrix A = 32 matrix rownames A = interview__id matrix list A …
Doubts on Diff-in-Diff methodDear Stata users, I am writing this post hoping that someone could help me. Here the story, I am a…
Can I regress company data as dependent and macroeconomic data as independent?Can I regress company data (as firm performance - the dependent variable) on macroeconomic data (as …
Subscribe to:
Post Comments (Atom)
0 Response to forval with a variable
Post a Comment