Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.
-
Upload
mark-carter -
Category
Documents
-
view
213 -
download
1
Transcript of Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.
![Page 1: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/1.jpg)
Formats to the Rescue
Gary McQuown Data and Analytic Solutions Inc.
Fairfax, VA.
![Page 2: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/2.jpg)
Combining Data
A
B
C
MERGE
SQL JOINKey
![Page 3: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/3.jpg)
Combining Data
INDEXA
B
C
![Page 4: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/4.jpg)
Combining Data
HASHINGA
C
B
![Page 5: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/5.jpg)
Combining DataA
G
C
E
D
C
B
HF
I
J
FORMATSKey W
Key ZKey YKey X
![Page 6: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/6.jpg)
Issues
Sorts or Index are Impractical
Many “Small” Tables
Frequently Used Process
Efficiency
Ease of Use
![Page 7: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/7.jpg)
Formats
Table lookup
Associate one value with another
format date date9.; 09OCT2006
format zip cityz. ; New York
![Page 8: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/8.jpg)
put ( start , $myfmt. )
First Name, Last Name, DEA #, EIN, SSN, DOB, Specialty, Complaints, Office Address, Home Address, States Licensed, Drug Class Allowed, Sanctions, etc.
Drug Names, Drug Category, Drug Class
Latitude, Longitude, City, County, State
![Page 9: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/9.jpg)
Advantages
No Sorting of Primary File
Sort Smaller Files
Unique Start Values
![Page 10: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/10.jpg)
Advantages
Efficient
(where=( put(start, $myfmt.) = “1” ))
Reads only selected rows
![Page 11: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/11.jpg)
Advantages
Flexible
var = put(start, $myfmt.);
if put(start, $myfmt.) = “XX”
format (start, myfmt.)
![Page 12: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/12.jpg)
Advantages
Reusable
(library = library) Catalogs
Reduces Coding (replaces if then !)
Easily Update
![Page 13: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/13.jpg)
Easy to Create
Numeric
proc format;
value SexNum
1=“Male“
0=“Female”;
run;
Character
proc format;
value $ SexChar
‘1’=“Male“
‘0’=“Female”;
run;
![Page 14: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/14.jpg)
proc sort data= FOO nodupkey; by FROM_VAL; run;
data MYFMT (keep = fmtname hlo label start type);
retain fmtname “MYFMT”
type “N”;
set FOO;
end = lastrec;
start = FROM_VAL;
label = TO_VAL;
output;
if lastrec then
do;
hlo = “O”;
label = “0”;
output;
end;
run;
proc format cntlin = MYFMT library=library; run;
![Page 15: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/15.jpg)
FMTNAME = name
TYPE = “C” “N” “I” “J” “P”
START =values to be converted.
LABEL =values to become.
HLO = “H” “L” “O”
![Page 16: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/16.jpg)
proc sort
data= FOO nodupkey;
by FROM_VAL;
run;
![Page 17: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/17.jpg)
data MYFMT
(keep = fmtname hlo
label start type);
retain fmtname “MYFMT”
type “N”;
set FOO;
end = lastrec;
start = FROM_VAL;
label = TO_VAL;
output;
![Page 18: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/18.jpg)
if lastrec then
do;
hlo = “O”;
label = “0”;
output;
end;
run;
![Page 19: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/19.jpg)
Other, HI and LOW
Dept_Num =put(EMPID, Department_Number.);Dept_Name =put(Dep_num, Department_Name.);Grade_Level =put(EMP_ID, Grade_Level.);Full_Name =put(EMPID, Full_Name.);
Dept_Name Full_Name EMP_ID Dept_Num Grade_Level
IT John Doe 13579 3 7
Management 24680 24680 2 2
Unknown Unknown 24680 0 0
![Page 20: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/20.jpg)
Other, HI and LOW
Dept_Num =put(EMPID, Department_Number.);Dept_Name =put(Dep_num, Department_Name.);Grade_Level =put(EMP_ID, Grade_Level.);Full_Name =put(EMPID, Full_Name.);
Dept_Name Full_Name EMP_ID Dept_Num Grade_Level
IT John Doe 13579 3 7
Management 24680 24680 2 2
Unknown Unknown 24680 0 0
![Page 21: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/21.jpg)
Other, HI and LOW
Dept_Num =put(EMPID, Department_Number.);Dept_Name =put(Dep_num, Department_Name.);Grade_Level =put(EMP_ID, Grade_Level.);Full_Name =put(EMPID, Full_Name.);
Dept_Name Full_Name EMP_ID Dept_Num Grade_Level
IT John Doe 13579 3 7
Management 24680 24680 2 2
Unknown Unknown 24680 0 0
![Page 22: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/22.jpg)
OPTIONS
FMTSEARCH to search Libraries
NOFMTERR use original values if the format does not exist
![Page 23: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/23.jpg)
Formats
Merging
Matching
Sub Setting
New Variables
Data Cleaning
Reporting
Analysis
Large Tables
Many Tables
Many Key Fields
Flexibility
Efficiency
Easy to Use
![Page 24: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/24.jpg)
Questionsand
Comments
![Page 25: Formats to the Rescue Gary McQuown Data and Analytic Solutions Inc. Fairfax, VA.](https://reader035.fdocuments.in/reader035/viewer/2022070400/56649f155503460f94c29fa7/html5/thumbnails/25.jpg)
Thank you
Gary McQuown Data and Analytic Solutions Inc.
Fairfax, VA.703-628-5681
http://www.DASconsultants.com
SAS is a Registered Trademark of the SAS Institute, Inc. of Cary, North Carolina.