I'm attempting to import data in a CSV file, where almost all variable values are surrounded by single quotes (apostrophes), as well as being comma delimited. I'd like to remove the single quotes so that I can destring and work with the values. Insheet and import delimited work fine as far as the commas go. I could clearly run through the vars with a loop and something like substr to remove the offending quotes, restricting to leading and trailing characters, and then destring the appropriate variables. But is there a simpler way to do it, perhaps an option for import delimited that I'm not realizing?
Here are the top few lines of the data:
CONTROL,JJOBCOMP,JJOBCOMPYR,JJOBCOST,JJOBDIY,JJOBF UNDS,JJOBTYPE,JJOBWORKYR,JOBTYPE,JOBDIY,JOBCOST,JO BCOMP,JOBCOMPYR,JOBWORKYR,JOBFUNDS
'11000001','0','0','0','0','0','0','0','30','1',30 ,'1','2','-6','1'
'11000002','0','0','0','0','0','0','0','16','2',11 000,'1','1','-6','1'
(It's the 2017 American Housing Survey National Public Use File, available here: https://www.census.gov/programs-surv...ile--puf-.html)
Related Posts with Importing CSV file with surrounding single quotes
Placebo TestHello, i am trying to run a placebo test with the synth command downloaded from the homepage of Jen…
Struggling to create this variableHi! For my thesis, I'm interested in the effect of a change in working hours on mental health outco…
Interaction with running variableIn my panel data set analysis, I interact the treatment variable with the running variable to see wh…
Merging 2 datasets with the same ID numberDear Members, I have been trying to merge 2 datasets. I have household sample and individual sample…
Problem with fixed effect in cross sectional dataHello everyone, I am doing research about racial discrimination in mortgage interest. Many resear…
Subscribe to:
Post Comments (Atom)
0 Response to Importing CSV file with surrounding single quotes
Post a Comment