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
psacalc with sureg - sharing codeHi, I have been working on bounds analysis using psacalc for my regress and xtreg, fe models. I nee…
Calculating response rates to surveysDear all, I have a project which sends surveys to participants based on certain events. I would li…
Annual constant increase rate from monthly data*Dear all! I have some monthly inflation CPI data and wanted to create two new time series. First, t…
Matching Panel Data to Diff-in-DiffHowdy, Statalisters, I'm trying to create comparison groups to ultimately move into a diff-in-diff e…
difficulty in exporting summary stat using asdocDear members I am trying to export summary stata for my study key variables per country. I want the…
Subscribe to:
Post Comments (Atom)
0 Response to Importing CSV file with surrounding single quotes
Post a Comment