How to convert sas .matrix file to csv or tsv file
1
0
Entering edit mode
19 months ago
Shadi • 0

I have been given two sas files named x.matrix which contains data and x.info which contains columns information. Since I code in R, I would like to convert them tables to a standard tab/comma delimited files. I tried readr package as well as read.delim in R with no chance; column names in .info do not match the table in R. My guess is that .matrix has variable number of white spaces between the columns! I have partially pasted the content of each for clarification. I will be appreciative if some could help me out. The final goal, any way, is to read in the .matrix file in R. Any solution then is appreciated. Thanks. x.matrix and x.info respectively:

x.matrix looks like this

x.info looks like this

R sas • 640 views
ADD COMMENT
0
Entering edit mode
19 months ago
Jeremy ▴ 910

You can try the following:

x = read.table('x.matrix')
write.csv(x, 'x.csv')

You would then need to add the column headers.
Also, you can write csv files in SAS, so if possible, you could reach out to whoever you got the files from to see if they can send them to you in csv format.

ADD COMMENT

Login before adding your answer.

Traffic: 3231 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6