EXTRACT_METADATA(1)

✨ extract_metadata ✨

okay bestie, gather round, because this little command is genuinely iconic and you're gonna love her πŸ’–


🌸 NAME 🌸

extract_metadata β€” she reads column metadata from SPSS and Stata binary files, and formats it as JSON. yes, that's the whole job, and she does it flawlessly, no cap. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

extract_metadata input-file output-file

that's it. two files in, zero drama. periodt. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: extract_metadata reads column metadata from existing binary data files, so that readstat can produce new, column-compatible binary files from CSV input files. the way that works is that both programs use JSON as a metadata interchange format β€” it's giving shared language, it's giving bestie-to-bestie communication, it's giving interoperability. 🌈

your input-file needs to be a file with one of these extensions, and ngl each one is a whole different flavor:

  • dta β€” Stata binary file, version 104 or newer
  • sav β€” SPSS uncompressed binary file
  • zsav β€” SPSS compressed binary file
and in ALL cases, no exceptions, your output-file should end in .json. like. please. the .json is the whole point. 😭

πŸ’œ EXAMPLE πŸ’œ

imagine this: you've got a Stata file with last year's survey data, and you want to produce a compatible Stata file containing this year's survey data. obsessed. so first, you extract the metadata:

extract_metadata last-year.dta survey-metadata.json

now you apply it to this year's data, which is stored in a CSV file:

readstat this-year.csv metadata.json this-year.dta

and here's the key part, bestie, don't skip it: the first line of the CSV file should contain column names which match the column names in last-year.dta. if everything went well, your new binary data set is now stored in this-year.dta. slay. new file, who dis. πŸ”₯


πŸ’… OPTIONS πŸ’…

  • None.

yeah. zero flags. she doesn't need them. she said "I'm enough." 🫢


🌟 AUTHOR 🌟

Copyright (C) 2012-2019 Evan Miller, and others where indicated.


and that's the whole page, fr fr πŸ’– this is the General Commands Manual version of extract_metadata(1), dated 01 February 2019 β€” take care of her, she's a legend, mwah πŸŽ€βœ¨πŸ¦‹