There is a given dummy dataset. I am trying to import it into the SAS environment and i also tried it in RStudio as well. But i was unable to grab the correct output. the dataset provided is as follows:
1 "name, age, salary, zipcode"
2 "A, 1, 100, 10010 B, 2, 200, 10011 C, 3, 300, 10012 D, 4, 400, 10014"
i copied the data from a CSV file. The line 1 was in the First cell of the CSV and Line 2 was in the second cell just below the first cell.
PS : 10010 is the zipcode where as B is the Name that is B is the starting of next observation and similiarly C is the next observation and D is the next observation.
The Desired output is:
Name Age Salary Zipcode
A 1 100 10010
B 2 200 10011
C 3 300 10012
D 4 400 10014
i am stuck with this problem since a day ago. I am just able to move around the dataset in order to move the observations. Moreover the double qouted values are making this problem very complex. A working Solution on SAS or R would work great.
EDIT: The following code has been tried by me in SAS. Thanks SMW for pointing. :)
data new;
length Name $2 Age 8. Salary 8. Zipcode 8.;
infile 'book1.csv' dsd dlm = ',' firstobs = 2 LRECL =17 ;
input Name $ Age Salary Zipcode @@;
run;
Regards
DLM=' ,"'
. But if any of the values are blank or if the names have embedded spaces then it will get confused. – Tom