Save sas formats

Accepted Solution Solved
Reply
Regular Contributor
Posts: 150
Accepted Solution

Save sas formats

I am using QDS and ACASI to collect data and one of the benefits is that when I export data from the program, formats are attached to the data file. How do I save the formats in new cleaned sas files that I create for analysis and to send to other people to use? Rigth now when I send someone the clean data I created and saved using a libname statement, none of the formats are attached so they have to delete them to use the file otherwise they get errors. Any suggestions would be greatly appreciated.


Accepted Solutions
Solution
‎08-20-2013 04:26 PM
Trusted Advisor
Posts: 3,212

Re: Save sas formats

Posted in reply to rfarmenta

see the QDS documentation about formats. There should a SAS export dataset and a SAS program (.sas) containing the formats.

http://www.novaresearch.com/products/QDS/QDS_Manual_2-4.pdf (pag 195)

Within SAS formats are more implemted like a program doing the formatting of values.

By that it is easier to reuse that once you have defined that and made permanent available.

This is a big advantage as standard setup. It even can act as lookup and doing more without to change the data. 

The disadvantage is the maintenance of this code-like artifacts.

---->-- ja karman --<-----

View solution in original post


All Replies
Solution
‎08-20-2013 04:26 PM
Trusted Advisor
Posts: 3,212

Re: Save sas formats

Posted in reply to rfarmenta

see the QDS documentation about formats. There should a SAS export dataset and a SAS program (.sas) containing the formats.

http://www.novaresearch.com/products/QDS/QDS_Manual_2-4.pdf (pag 195)

Within SAS formats are more implemted like a program doing the formatting of values.

By that it is easier to reuse that once you have defined that and made permanent available.

This is a big advantage as standard setup. It even can act as lookup and doing more without to change the data. 

The disadvantage is the maintenance of this code-like artifacts.

---->-- ja karman --<-----
Regular Contributor
Posts: 150

Re: Save sas formats

I know that QDS has the option to export the datasets and formats into sas, but they use SAS transport files for sas version 8.0, I am using version 9.3. Will this cause problems? I actually export out of the QDS warehouse into SPSS and read the SPSS file, with formats, into SAS. I am not sure why Nova hasn't updated their SAS exporting procedures.

Trusted Advisor
Posts: 3,212

Re: Save sas formats

Posted in reply to rfarmenta

SAS should be able to import old style transport files. The SAS code of the formats you should a also have.

It is documented SAS will use the 6.12 structure  when degression SAS eg from 9.3 to 9.2.

By now you have hit a design difference between SPSS and SAS. This is bringing you into the formats trouble. 
With SAS you are needing to the two described datasets. 

---->-- ja karman --<-----
Super User
Posts: 11,343

Re: Save sas formats

Posted in reply to rfarmenta

If you are getting an *.SAS file that has Proc Format statements you have three main options.

1) Send the Format code to your users and have them run it.

2) Run the format code with the cntlout option to create a set that can create a dataset that can rebuild the formats and send that along with the data and instructions to run Proc Format with the CNTLIN option to create the formats in their system.

3) Use proc cport to export the format catalog, but this may not work if they are on a different OS.

Since formats only affect display of values and do not affect the actuall values in the data set there isn't much to clean up.

My person choice as a user receiving such things is the first one above. I can then more easily modify the code if I find the supplied versions clunky or not quite to my taste.

If they are using the data and gettine errors of "Format not found" then the quicker fix is OPTION NOFMTERR;

Regular Contributor
Posts: 150

Re: Save sas formats

Thank you for the information. I was able to get the transport files to work for the data and am not trying to get the formats to work. I keep getting the error, "ERROR: This range is repeated, or values overlap: 9-9.", when reading the formats provided by QDS into sas.

Super User
Posts: 5,427

Re: Save sas formats

Posted in reply to rfarmenta

Then perform option 2 suggested by ballardw.

Data never sleeps
Super User
Posts: 11,343

Re: Save sas formats

Posted in reply to rfarmenta

The error messange indicates that at least one of the formats is defined incorrectly. The values shown, 9-9. , means most likely that 9 is included in another range within the same format, such as 1-10, within the proc format code. The format immediately above the error message in the log is the culprit. Adust the ranges and resubmit the format code and things should be okay. IF you have lots of these then the source application has a bug.

Regular Contributor
Posts: 150

Re: Save sas formats

I was informed by the company that there is an error in how they export the formats for SAS and am downloading the patch and hope that will work. We have over 1500 variables so I do not want to have to create formats myself. Jaap, I do want to use the formats, I think I accidentally put "not" instead of "now" in my last response, sorry about that. Thanks again everyone for your help. 

Trusted Advisor
Posts: 3,212

Re: Save sas formats

Posted in reply to rfarmenta

Does not matter for typo-s, I make them often. And by that the wishfull thinking/hope it is kept understandable. Smiley Wink

---->-- ja karman --<-----
Trusted Advisor
Posts: 3,212

Re: Save sas formats

Posted in reply to rfarmenta

But if you do not want to use formats... why did you ask for them as a problem in your Original question

---->-- ja karman --<-----
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 379 views
  • 6 likes
  • 4 in conversation