SAS dataset to CSV


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users SAS dataset to CSV
# 15  
Old 05-22-2018
Hi ,

The thing is i am unable to view cat the .sas7dbat file which is holding no many special characters

Code:
cat sample.sas7bdat
^]▒AA▒▒▒▒▒▒▒▒▒0▒^_▒BA▒▒▒▒ŇAAx▒▒▒#▒DA▒▒▒▒_;CA▒▒▒▒▒▒▒▒kA▒o%ȨKjA▒Fؽ5>oAT▒|▒▒lA▒▒▒▒▒o
                                                                                 ▒▒▒@▒)P▒▒▒A▒▒▒CWWAMALAYSIA INCL DSR▒NCCPL_IL▒[XXXX]$ xtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtemxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxtermxterm^C

od -bc sample.csv

0501720 346 202 123 107 104 345 205 101 123 055 123 107 104 343 202 123
        346 202   S   G   D 345 205   A   S   -   S   G   D 343 202   S
0501740 107 104 341 206 125 055 120 122 114 055 111 351 202 123 107 104
          G   D 341 206   U   -   P   R   L   -   I 351 202   S   G   D
0501760 345 210 123 151 156 147 141 160 157 162 145 341 202 123 107 104
        345 210   S   i   n   g   a   p   o   r   e 341 202   S   G   D
0502000

# 16  
Old 05-22-2018
Quote:
Originally Posted by Master_Mind
Hi rudic,

For eg my file is sample.sas7bdat which has below columns

Code:
id name country
01 xyz AUS
02 yyy NZ

My sample.csv will have the same data
So, are we supposed to assume that this post was a lie? You didn't say anything about any special characters in sample.sas7bdat when you first told us you wanted to convert sample.sas7bdat to sample.csv.

What did you use to produce the above shown output from sample.sas7bdat?
# 17  
Old 05-22-2018
Hi,

This file is generated using SaS 9.4 script. I just did cat on this file and can able to see many special characters.It may be bacause i am unable to view the content of sas7bdat file like normal flat file
# 18  
Old 05-22-2018
See my post#10, last line.


Please don't assume people to be familiar with Sas, and provide the (ALL!) details necessary to understand, analyse, and solve the situation and your problem.
# 19  
Old 05-22-2018
Please show us the exact SAS command (or sequence of SAS commands) you used to produce the file sample.sas7bdat that you showed us (which did not contain any special characters) in post #5 in this thread.
# 20  
Old 05-22-2018
SAS can directly export CSV format

Happened to use SAS for a while long time ago. It seems to me there is an option to do the conversion within SAS platform, which even has the GUI interface now. Something like:
Code:
proc export data=sample.sas7bdat
    outfile='sample.csv' 
    dbms=csv 
    replace; 
run;

HTH.

Last edited by yifangt; 05-22-2018 at 04:43 PM..
These 2 Users Gave Thanks to yifangt For This Post:
# 21  
Old 05-23-2018
Thanks,

This requires SAS to be installed in unix machine then you can use that command to export to csv.

Problem here is i have no clue how this sample.sas7bdat is generated. All i know is its generated using SAS code and any sas7bdat file if you try opening in unix this special character will come. I mean not in proper readable format
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to extract subset file from dataset?

Hello I have a data set which looks like this : progeny sire dam gender 12 1 3 M 13 2 4 F 14 2 5 F 15 6 5 ... (13 Replies)
Discussion started by: sajmar
13 Replies

2. Solaris

ZFS - Dataset / pool name are the same...cannot destroy

I messed up my pool by doing zfs send...recive So I got the following : zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 928G 17.3G 911G 1% 1.00x ONLINE - tank1 928G 35.8G 892G 3% 1.00x ONLINE - So I have "tank1" pool. zfs get all... (8 Replies)
Discussion started by: eladgrs
8 Replies

3. Solaris

flarecreate for zfs root dataset and ignore multiple dataset

Hi All, I want to write a script to create flar images on multiple servers. In non zfs filesystem I am using -X option to refer a file to exclude mounts on different servers. but on ZFS -X option is not working. I want multiple mounts to be ignore on ZFS base system during flarecreate. I... (0 Replies)
Discussion started by: uxravi
0 Replies

4. Programming

Dataset Library for C?

I am looking for an opensource dataset library for C. Something equivalent to ADO.Net. Specifically, I am looking for the following features: 1. Create a Dataset from a file (XML or CSV). 2. Create a Dataset from a select query using an ODBC connection. 3. Load a created Dataset into a... (1 Reply)
Discussion started by: a_programmer
1 Replies

5. Shell Programming and Scripting

How to extract a subset from a huge dataset

Hi, All I have a huge file which has 450G. Its tab-delimited format is as below x1 A 50020 1 x1 B 50021 8 x1 C 50022 9 x1 A 50023 10 x2 D 50024 5 x2 C 50025 7 x2 F 50026 8 x2 N 50027 1 : : Now, I want to extract a subset from this file. In this subset, column 1 is x10, column 2 is... (3 Replies)
Discussion started by: cliffyiu
3 Replies

6. Shell Programming and Scripting

Computing dataset for a specific record

Hello everybody, I want to compute a data file in awk. I am new in awk and I need your help. The data file has the following fields. It has thousands of records. Col1 Col2 Col3 Col4 Col5 0.85 0.07 Fre 42:86 25 0.73 0.03 frp 21:10 28 0.64... (12 Replies)
Discussion started by: ubeejani
12 Replies

7. Shell Programming and Scripting

Normalize a dataset with AWK

Hello everyone, i have to normalize this dataset (with 20.000 rows): 2,4,4,3,2,7,8,2,9,11,7,7,1,8,5,6 4,7,5,5,5,5,9,6,4,8,7,9,2,9,7,10 7,10,8,7,4,8,8,5,10,11,2,8,2,5,5,10 4,9,5,7,4,7,7,13,1,7,6,8,3,8,0,8,8 6,7,8,5,4,7,6,3,7,10,7,9,3,8,3,7,8 in this form:... (1 Reply)
Discussion started by: [raven]
1 Replies

8. Programming

Finding number of records in SAS dataset

I am running the following Korn shell script: #!/usr/bin/ksh num_records=`sas "select count(*) from /users/abc/123/sasdata.sas7bdat"` echo "$num_records" The script keeps returning an invalid file error even though I am certain that the file really exists. Does anyone see anything wrong... (1 Reply)
Discussion started by: sasaliasim
1 Replies

9. Shell Programming and Scripting

Numbers of records in SAS dataset

I'm declaring a variable within a Korn shell to represent the total number of records in a SAS dataset and could use a little help with the syntax. This is what I have thus far: #!/usr/bin/ksh RecCount = `sas -x "select count(*) from /users/abc/123/sas_dataset.sas7bdat"` (2 Replies)
Discussion started by: sasaliasim
2 Replies

10. UNIX for Dummies Questions & Answers

Accessing Mainframe Dataset

Hi May I know is there a way to read/copy a mainframe (IBM OS/390) dataset (sequential file) into a UNIX directory? Thank you for your time. IcyGuava (4 Replies)
Discussion started by: IcyGuava
4 Replies
Login or Register to Ask a Question