Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Add "if" condition #24

Open
jadelcar opened this issue Oct 2, 2020 · 0 comments
Open

Add "if" condition #24

jadelcar opened this issue Oct 2, 2020 · 0 comments

Comments

@jadelcar
Copy link

jadelcar commented Oct 2, 2020

My suggestion is to allow for an "if" condition in the command.

Many times, I am importing an excel where many values have not been reviewed yet. This means that I will have a column "Reviewed", used by the data entrant and that takes values 0/1 depending if the data entrant has already reviewed the value. Thus, I only want to readreplace if the entry has reviewed==1. Otherwise, it will replace a value by missing (because "newvalue" is missing by default).

So far I have been using the following workaround, but it would be nice to avoid doing this everytime.

What I do: Import the excel, keep only the value I want, save it as a tempfile, and then apply readreplace to the temfile.

preserve
      import excel_filename, (...)
      keep if review==1
      tempfile excel_file
      save `excel_file'
restore

readreplace using `excel_file', use (...)

I think it's a small thing but a very useful one! And please do let me know if there's already a way to do this in the same line as readreplace, maybe I've missed something.

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant