Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: programming loop local question


From   moleps islon <moleps2@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: programming loop local question
Date   Thu, 25 Jun 2009 00:28:25 +0200

I´m automating a bar graph program with ci and everything is working
out allright except for this loop and local variable that I cannot
figure out.
.....bunch of stuff first
local r=0

while p+1>`r'{
	gen e`r'="(bar gcs m if `2'==`r') "
	
	local list `list' e`r'
	local r=`r'+1
	}

tw `list' (rcap higcs logcs m)


and I get :

invalid 'e1'
r(198);



Error searching with a display of the local :

local r=0

while p+1>`r'{
	di p
	di `r'
	gen e`r'="(bar gcs m if `2'==`r') "
	di e`r'
	local list `list' e`r'
	di `list'
	local r=`r'+1
	}

tw `list' (rcap higcs logcs m)



2
0
(bar gcs m if maxaisorgansystemhead==0)
(bar gcs m if maxaisorgansystemhead==0)
2
1
(bar gcs m if maxaisorgansystemhead==1)
(bar gcs m if maxaisorgansystemhead==0) (bar gcs m if maxaisorgansystemhead==1)
2
2
(bar gcs m if maxaisorgansystemhead==2)
(bar gcs m if maxaisorgansystemhead==0) (bar gcs m if
maxaisorgansystemhead==1) (bar gcs m if maxaisorgansystemhead==2)
(bar gcs m if maxaisorgansystemhead==0) (bar gcs m if
maxaisorgansystemhead==1) (bar gcs m if maxaisorgansystemhead==2)
invalid 'e1'
r(198);


I´m sure there is a simple solution but I´ve trying with all sorts of
different " " ´` combinations without getting it to work and the last
display of the local seems to work so I really dont have a clue...

Regards,

Moleps

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index