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

Add "if" condition #24

Open
Open
@jadelcar

Description

@jadelcar

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions