Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Need help with Programming multiple datasets |

Date |
Sun, 2 Jun 2013 17:58:49 +0100 |

We understand. Just advice. Nick njcoxstata@gmail.com On 2 June 2013 17:56, Michael Stewart <michaelstewartresearch@gmail.com> wrote: > Hi Nick, > Thanks a lot for the reply. > fyi: I didnt mean to disrespect any statalist user and certainly shout. > As the post was long, I wanted to make sure I highlight the problem. > Sorry again. > Thanks a lot for your help. > Sincerely > Mike > > On Sun, Jun 2, 2013 at 12:17 PM, Nick Cox <njcoxstata@gmail.com> wrote: >> understand why). >> >> Your two problems are really the same. You want a wildcard for a >> variable list that includes every variable desired, but no more. >> >> Reading >> Nick >> njcoxstata@gmail.com >> >> >> On 2 June 2013 16:40, Michael Stewart <michaelstewartresearch@gmail.com> wrote: >>> Need help with Programming multiple datasets >>> >>> Dear Statalist user , >>> I need help with stat porgramming. >>> >>> I am working with multiple datasets and with the help of statalist >>> users, was able to figure out a way to use multiple datasets, complete >>> data management tasks and save them under separate files >>> >>> MY DATA STRUCTURE: >>> *************************************************************** >>> auto-1 contains variables DX1-DX15; variables DXCCS1-DXCCS-15 + OTHER VARIABLES >>> auto-2 contains variables DX1-DX25 ; variables DXCCS1-DXCCS-25 + >>> OTHER VARIABLES >>> auto-3 contains variables DX1-DX35 ; variables DXCCS1-DXCCS-35 + >>> OTHER VARIABLES >>> **************************************************************** >>> >>> >>> My current code is as follows >>> *********************************************** >>> local ds1 "D:\_Dummy\multiple\1\auto_1.dta" >>> local ds2 "D:\_Dummy\multiple\2\auto_2.dta" >>> local ds3 "D:\_Dummy\multiple\3\auto_3.dta" >>> local all ds1 ds2 ds3 >>> foreach x in `all'{ >>> use ``x'',clear >>> include "D:\_Dummy\multiple\4\a.do" >>> include "D:\_Dummy\multiple\5\b.do" >>> save ``x''_new.dta,replace >>> } >>> *********************************************** >>> >>> NEW PROBLEM-1: >>> If I want to run a forvalues loop in local "a" OR local "b" FOR ONLY >>> DX1-15(for auto_1 ) OR DX1-25(auto_2) OR DX1-35(auto_3) BUT SHOULD NOT >>> LOOP OVER ANY OTHER SIMILAR VARIABLES like DXCCS1 DXCCS2 etc >>> >>> How can I modify my present forvalues loop to INCLUDE VARYING NUMBER >>> OF DX* VARIABLES >>> My present loop is >>> >>> forvalues y=2/15{ >>> icd9 generate diag_`x'=DX`x', range("xxx.x") >>> } >>> >>> NEW PROBLEM-2: >>> >>> If I want to run a forvalues loop in local "a" OR local "b" FOR ONLY >>> DXCCS1-15(for auto_1 ) OR DXCCS1-25(auto_2) OR DXCCS1-35(auto_3) BUT >>> SHOULD NOT LOOP OVER ANY OTHER SIMILAR VARIABLES like DX1 DX2 etc >>> >>> How can I modify my present forvalues loop to INCLUDE VARYING NUMBER >>> OF DX* VARIABLES >>> My present loop is >>> forvalues y=2/15{ >>> icd9 generate diag_`x'=DX`x', range("xxx.x") >>> } >>> >>> >>> IF FOREACH LOOP is better , please let me know the appropriate code >>> >>> I thank in advance for all your help. >>> >>> -- >>> Thank you , >>> Yours Sincerely, >>> Mike. >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>> * http://www.ats.ucla.edu/stat/stata/ >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > > > > -- > Thank you , > Yours Sincerely, > Mike. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Need help with Programming multiple datasets***From:*Michael Stewart <michaelstewartresearch@gmail.com>

**Re: st: Need help with Programming multiple datasets***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Need help with Programming multiple datasets***From:*Michael Stewart <michaelstewartresearch@gmail.com>

- Prev by Date:
**Re: st: Need help with Programming multiple datasets** - Next by Date:
**st: outsheet and variable labels** - Previous by thread:
**Re: st: Need help with Programming multiple datasets** - Next by thread:
**st: RE: Need help with Programming multiple datasets** - Index(es):