Git Product home page Git Product logo

grades_sum_stats's People

Watchers

 avatar  avatar

grades_sum_stats's Issues

coding tips

Just came across your repo and thought I'd offer some suggestions that could make your script more stable/flexible and follow typical coding practices in Stata.

  1. Rename grade_sum_stats.do to grade_sum_stats.ado. This will make it easier to pass parameters and for others to use the command.
  2. Include a version number after defining the program (e.g., version 13.1). The syntax for insheet changed a bit in version 14 and it might result in code breaking, while the version command will help to make sure the code is interpretted consistently across versions.
  3. What happens if the user doesn't have outreg2 available on their system? I created a utility for another program I was working on here that will install the program if unavailable (assuming it is available from the ssc). This can avoid problems with that (especially if you ever need to get a new machine or need the code to be portable).
  4. You can get rid of the first loop in the script using
ds, not(type string)
loc grade_vars `r(varlist)'
ds, has(type string)
loc string_vars `r(varlist)'

di as res `"The variables `: subinstr loc grade_vars `" "' `", "', all' are numeric.  And "' _n `"The variables `: subinstr loc string_vars `" "' `", "', all' are string variables"'
  1. If you include either the lower level commands to parse the parameters or the syntax command, you can allow users to pass values a bit more flexibly and consistently. (e.g., if the user is using file paths with embedded strings the insheet command will likely fail when it expands the local macros).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.