12-31-2012 07:13 PM
Dear Fellow SAS Users,
I am doing exercises in Base SAS and SAS/STAT (using SAS 9.3 in Windows) from the book "Discovering Statistics Using SAS" by Andy Field and Jeremy Miles, and I encountered the attached strange data set. It has a non-existing variable format that prevents me from using it. I would much appreciate your help to fix this problem.
This data set, named downloadfestival.sas7bdat, is in the collection of data provided by the book's companion web site.
The variable GENDER has a format called GENDER, as found when I run PROC CONTENTS.
Discovering Statistics Using SAS - Chapter 4 Exercises 34
Histogram for Day 1 Hygiene
17:05 Monday, December 31, 2012
The CONTENTS Procedure
Data Set Name CHAPTER4. Observations 810
Member Type DATA Variables 5
Engine V9 Indexes 0
Created Monday, December 31, Observation Length 40
2012 05:54:19 PM
Last Modified Monday, December 31, Deleted Observations 0
2012 05:54:19 PM
Protection Compressed NO
Data Set Type Sorted YES
Data Representation WINDOWS_32
Encoding wlatin1 Western
Engine/Host Dependent Information
Data Set Page Size 4096
Number of Data Set Pages 9
First Data Page 1
Max Obs per Page 101
Obs in First Data Page 60
Number of Data Set Repairs 0
Filename C:\SAS\SAS Training\Data - Discovering
Release Created 9.0301M0
Host Created W32_7PRO
Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
3 DAY1 Num 8 F8.2 Hygiene (Day 1 of Download Festival)
4 DAY2 Num 8 F8.2 Hygiene (Day 2 of Download Festival)
5 DAY3 Num 8 F8.2 Hygiene (Day 3 of Download Festival)
2 GENDER Num 8 GENDER. Gender of Concert Goer
1 TICKNUMB Num 8 F11. Ticket Number
Character Set ANSI
When I run the code,
I get this in the log:
ERROR: The format GENDER was not found or could not be loaded.
I can't even open this data set in the Explorer. Can anybody fix this problem of a non-existing variable format?
Thank you for your help.
12-31-2012 08:24 PM
You can create a copy of the dataset and associate an existing format to variable GENDER :
format gender best10.;
you will see that GENDER takes values 0 and 1. You can then create your own substitute format :
0 = "M"
1 = "F";
format gender gender.;
but you will have to guess which is M and which is F.
01-01-2013 04:32 PM
I was able to go back to the book and see from the source material that 0 = Male and 1 = Female. However, assuming that I did not know that, is there any way for me to uncover what the original format GENDER meant?
01-01-2013 05:21 PM
Not by yourself. You would have to ask the author of the code for the answer. In real life, it should not happen in an environment running SAS on a regular basis, any shipped-out SAS code package should be in the status of "ready to run" with minimum requirement on users, meaning everything needed should be included, such as user manual (interface control document), autoexec.sas, config file, format, auto macro or macro code for compiled macro, etc.