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 8727995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:32:28+00:00 2026-06-13T08:32:28+00:00

I run a DO in Stata cleaning my dataset and then call Python to

  • 0

I run a DO in Stata cleaning my dataset and then call Python to run a script to generate some needed variables (3 columns) using:

outsheet unique_id group_1 group_2 group 3 group_4 group_5 group_6 group_7 using groups.csv, comma replace

shell python.exe group_fix.py

This creates a spreadsheet called group_fix.csv that has 4 columns unique_id, group_fix_1, group_fix_2, and group_fix 3. I would like to use the unique_id field (which is in my dataset and the Py output) to merge these datasets. So basically in Stata it will look like before I called Py plus the 3 new columns my script created so I can then continue on my DO and do the needed analysis.

Any ideas?

  • 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-06-13T08:32:29+00:00Added an answer on June 13, 2026 at 8:32 am

    I think what you’re looking for is a tempfile. You can do something like this

    sort unique_id
    tempfile original
    save "`original'"
    clear
    insheet using group_fix.csv, comma
    sort unique_id
    merge unique_id using "`original'"
    

    This creates a temporary file named “original” which stores the original dataset. You then merge the dataset that was cleaned with the python script with the original data on unique_id. Also it’s worth pointing out that in the commands like

     save "`original'"
    

    The first ` is the character under the tilda; the second ‘ is a single quote

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In R, I can run another R script using source(script.R) How can I do
Im using outproc session that is managed by aspnet_state. Sometimes I get run time
I run command: sudo apt-get install phpmyadmin to install phpMyAdmin. Then I enter address:
I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->
To run the spec files & assets as coffee script, I decided to go
I'm learning Ruby (using version 1.8.6) on Windows 7. When I try to run
I have some applications deployed to run@cloud that are in the stopped state. Is
I run a medium sized website on an ASP.net platform and using MS SQL
I have a little issue using SVN. When I run svn stat I get
SwingWorker lets you prepare some data in a background Thread and then use it

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.