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
Using margins, test, and lincom to test hypothesis that two predictive values are equalHi, I'm trying to do something that should be easy but I'm not certain I am doing it/interpreting th…
Help Recreating a Graph (Regression line and density at points)I would like to recreate this graph from Mostly Harmless Econometrics: An Empiricist’s Companion (pa…
Persistent class objects with ado programsI'm attempting to create an -ado- program whose purpose is to create an instance of a class and then…
how to use an asterisk(*) for multiple variables with an "if" conditionDear all, i have an issues which iam trying to figure out but i am not getting anywhere and i need u…
Consideration on the Expand command : Rename a duplicated observationHi everyone, I am a neophyte on Stata, I don't think this question is complicated but in the help co…
Subscribe to:
Post Comments (Atom)
0 Response to Importing CSV file with surrounding single quotes
Post a Comment