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]

st: forvalues problem


From   Morrison Hodges <[email protected]>
To   [email protected]
Subject   st: forvalues problem
Date   Sat, 25 Aug 2012 18:19:38 -0500

I have the following code:
----------------------------------
/*                  cdp.do

    Creating a cumulative distribution plot for use in PreFib analysis
    Created by MH on Friday, August 23, 2012
                                    */
version 12.1

capture log close
set more off

use prefib.dta, clear

label data "PreFib Data"

summarize grpa_jumpnmbr /* to get the number of rows in grpa_jumpnmbr */
local nmbr r(N)             /* gets the number of rows in grpa_jumpnmbr */
sort grpa_jumpnmbr /* sorts grpa_jumpnmbr from lowest to highest */
gen ptile = 0                /* new variable to place percentiles in */
gen dif = 1/`nmbr' /* generates the percentile difference to be added to each row */
replace ptile in 1 = dif    /* lowest number is the lowest percentile */

forvalues i = 2/`nmbr' {

    local back = (ptile in (`i' - 1))
    replace ptile in `i' = back + dif

}

log close
---------------------------------------
I get a syntax error with this, but I don't know why. Thanks in advance for any help.

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


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