# Following data extraction and loading in R, I keep getting a dataset with observations but zero variables

**URL:** <https://forum.ipums.org/t/following-data-extraction-and-loading-in-r-i-keep-getting-a-dataset-with-observations-but-zero-variables/3794>\
**Category:** CPS\
**Created:** [October 8, 2020, 2:56am UTC](https://forum.ipums.org/t/following-data-extraction-and-loading-in-r-i-keep-getting-a-dataset-with-observations-but-zero-variables/3794 "2020-10-08T02:56:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray\_Khalfani](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.ipums.org/ray_khalfani/32/381_2.png) [@Ray\_Khalfani](https://forum.ipums.org/u/Ray_Khalfani)\
**Post date:** [October 8, 2020, 2:56am UTC](https://forum.ipums.org/t/following-data-extraction-and-loading-in-r-i-keep-getting-a-dataset-with-observations-but-zero-variables/3794/1 "2020-10-08T02:56:29Z")

</div>

In IPUMS CPS, for my variables I’m choosing: HOURWAGE, AGE, RACE, EARNWT, MARST, STATEFIP (Once I troubleshoot this, I will eventually choose more variables). I’m choosing 2020 for my sample. When creating my extract, my data structure is rectangular with CSV format. When loading my extract into R, I use this code:  
ddi ← read\_ipums\_ddi(“cps\_00035.xml”)  
data ← read\_ipums\_micro(ddi)

After doing this however, I keep ending up with 200K+ observations and 0 variables, and I get the error message: Version:1.0 StartHTML:0000000107 EndHTML:0000001754 StartFragment:0000000127 EndFragment:0000001736

Warning: 270540 parsing failures. row col expected actual file 1 – 3 columns 1 columns ‘./cps\_00035.csv’ 2 – 3 columns 1 columns ‘./cps\_00035.csv’ 3 – 3 columns 1 columns ‘./cps\_00035.csv’ 4 – 3 columns 1 columns ‘./cps\_00035.csv’ 5 – 3 columns 1 columns ‘./cps\_00035.csv’ … … … … … See problems(…) for more details. Warning message: The following named parsers don’t match the column names: YEAR, SERIAL, MONTH, HWTFINL, CPSID, ASECFLAG, ASECWTH, STATEFIP, PERNUM, WTFINL, CPSIDP, ASECWT, AGE, SEX, RACE, MARST, EARNWT, HOURWAGE

Help! What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Grace\_Cooper](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.ipums.org/grace_cooper/32/376_2.png) [@Grace\_Cooper](https://forum.ipums.org/u/Grace_Cooper)\
**Post date:** [October 14, 2020, 9:12pm UTC](https://forum.ipums.org/t/following-data-extraction-and-loading-in-r-i-keep-getting-a-dataset-with-observations-but-zero-variables/3794/2 "2020-10-14T21:12:03Z")

</div>

The R code provided with your extract needs to be used with microdata (.dat file), not a CSV file. You can revise your extract to be a microdata file by clicking “Revise” next to your extract in the “My Data” tab, then click “Change” next to “Data Format”. From there, select “Fixed-width text (.dat)” as your data format and resubmit. If you choose to use a CSV file, you will need to use different commands to read the file, such as read.csv() or read.table(). These [exercises](https://ipums.org/support/exercises) (specifically [Exercise 1](https://assets.ipums.org/_files/exercises/ipums-cps-exercise-r-1.pdf) and [Exercise 2](https://assets.ipums.org/_files/exercises/ipums-cps-exercise-r-2.pdf) on the CPS) may be helpful to you in learning how to use IPUMS data in R.
