BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dr2014
Quartz | Level 8

Hi,

I have to convert a sas file to spss . The original sas dataset can only be opened after a proc format statement is run to account for the new formats. After that , I am able to open the sas dataset. Can this dataset then be converted to a spss file using the following program

get sas data='c:\sas\data\class.xpt'.
execute.

How can I ensure proper conversion. Please advice on the steps.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Then try proc export.
To ensure formatted variables transfer properly I have a habit of including both the formatted and unformatted variable. Sometimes I also convert the formatted variable using a PUT() statement as well. It depends on the data.

View solution in original post

7 REPLIES 7
Reeza
Super User
Are you working in SPSS or SAS?
If you want an SPSS file, export to SPSS and use the appropriate DBMS, either SAV or SPSS.
dr2014
Quartz | Level 8

@Reeza,  I am working in sas.

Reeza
Super User
Then try proc export.
To ensure formatted variables transfer properly I have a habit of including both the formatted and unformatted variable. Sometimes I also convert the formatted variable using a PUT() statement as well. It depends on the data.
dr2014
Quartz | Level 8

The unformatetd varibale is not present for this variable in the dataset. That's the reason for my concern. I will have to create a new one representing the unformatted one and then transfer. Would that be a good step?

Reeza
Super User
I consider it best practice myself 🙂
dr2014
Quartz | Level 8

Thanks. Then I will make sure to have it. I have one more question. For the variable 'title' with the format...I have to run the proc format statement first. Say the format name for it is 'west'. After I run the proic format then only I am able to open the sas dataset in lib=work. If not it triggers a message saying


NOTE: Format WEST was not found or could not be loaded.
NOTE: There were 437 observations read from the data set WORK.ORIGINAL.
NOTE: The data set WORK.TEMP has 437 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

 

When I run a proc contents on work.temp I see the format 'west' listed against the vairiable 'title'. However, when I look at the column attributes of the variable in the dataset, the format is listed as BESTX12.

 

What is 'bestx12.' ? Please let me know.

dr2014
Quartz | Level 8

Please ignore my alst question. Thanks for your help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 3581 views
  • 0 likes
  • 2 in conversation