Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7405199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:22:01+00:00 2026-05-29T05:22:01+00:00

I would like to pass the noconstant option from a wrapper program to an

  • 0

I would like to pass the noconstant option from a wrapper program to an inside regress call. The following solution works, but it seems particularly janky and not extensible if I would like to pass several options.

webuse grunfeld, clear

capture program drop regress_wrapper
program define regress_wrapper
    version 11.2
    syntax varlist(min=2 numeric) [if] [in] ///
        [, noconstant(string)]
    tokenize `varlist'
    local y `1'
    macro shift
    local x `*'
    regress `y' `x', `noconstant'
end    

regress_wrapper invest mvalue kstock
regress_wrapper invest mvalue kstock, noconstant(noconstant)

I thought that something more like the following would work, but it doesn’t pass the noconstant option.

capture program drop regress_wrapper
program define regress_wrapper
    version 11.2
    syntax varlist(min=2 numeric) [if] [in] ///
        [, noconstant]
    tokenize `varlist'
    local y `1'
    macro shift
    local x `*'
    regress `y' `x', `noconstant'
end    

regress_wrapper invest mvalue kstock
regress_wrapper invest mvalue kstock, noconstant
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:22:04+00:00Added an answer on May 29, 2026 at 5:22 am

    The second doesn’t work because the local macro ends up being called constant, not noconstant, as described at help syntax##optionally_off. So it should work if you replace:

       regress `y' `x', `noconstant'
    

    by:

       regress `y' `x', `constant'
    

    If you want to pass several options on, it’s easier to use the * syntax explained at help syntax##description_of_options :

    If you also specify
    *, any remaining options are collected and placed, one after the other in
    `options’.

    e.g.:

           syntax varlist(min=2 numeric) [if] [in] ///
                [, *]
           ...
           regress `y' `x', `options'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to pass a MYSQL query via Coldfusion the following date: 03/13/2010
I would like to pass a vector of strings from C++ to MATLAB. I
I would like to pass a variable from one Controller Action to another and
I would like to pass some data structures from java to perl. In perl,
I would like to pass 2 javascript string arrays myArray1 and myArray2 from ajax
I would like to pass parameter from view to controller in cshtml page. This
I would like to pass certain data from an instance of an object to
I would like to pass Variables from my package into Script Transformation Editor. How
I have some variables that I would like to pass into an AJAX call:
I would like to pass arguments from an activity B to A where B

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.