-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathexport_spss.sas
99 lines (76 loc) · 3.96 KB
/
export_spss.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*=====================================================================
Program Name : export_spss.sas
Purpose : Wrapper macro for the %export_dbms macro
used to export a SAS dataset to an SPSS file.
SAS Version : SAS 9.4
Input Data : SAS dataset
Output Data : SPSS flat file
Macros Called : export_dbms, parmv
Originally Written by : Scott Bass
Date : 04SEP2019
Program Version # : 1.0
=======================================================================
Scott Bass ([email protected])
This code is licensed under the Unlicense license.
For more information, please refer to http://unlicense.org/UNLICENSE.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
=======================================================================
Modification History : Original version
=====================================================================*/
/*---------------------------------------------------------------------
Usage:
See Usage in the %export_dbms macro header.
-----------------------------------------------------------------------
Notes:
See Notes in the %export_dbms macro header.
---------------------------------------------------------------------*/
%macro export_spss
/*---------------------------------------------------------------------
Wrapper macro for the %export_dbms macro
used to export a SAS dataset to an SPSS file.
---------------------------------------------------------------------*/
(DATA= /* Dataset to export (REQ). */
/* Data set options, such as a where clause, may be */
/* specified. */
,PATH= /* Output directory or file path (REQ). */
/* Either a properly quoted physical file */
/* (single or double quotes), or an already allocated */
/* fileref may be specified. */
,REPLACE=N /* Replace output file? (Opt). */
/* Default value is NO. Valid values are: */
/* 0 1 OFF N NO F FALSE and ON Y YES T TRUE */
/* OFF N NO F FALSE and ON Y YES T TRUE */
/* (case insensitive) are acceptable aliases for */
/* 0 and 1 respectively. */
,LABEL=N /* Use data set labels instead of names? (Opt). */
/* Default value is NO. Valid values are: */
/* 0 1 OFF N NO F FALSE and ON Y YES T TRUE */
/* OFF N NO F FALSE and ON Y YES T TRUE */
/* (case insensitive) are acceptable aliases for */
/* 0 and 1 respectively. */
/* If the data set variable does not have a label */
/* then the variable name is used. */
);
%local macro parmerr;
%let macro = &sysmacroname;
%* check input parameters ;
%parmv(DATA, _req=1,_words=1,_case=N) /* words=1 allows multiple datasets */
%parmv(PATH, _req=1,_words=1,_case=N)
%parmv(REPLACE, _req=0,_words=0,_case=U,_val=0 1)
%parmv(LABEL, _req=0,_words=0,_case=U,_val=0 1)
%if (&parmerr) %then %return;
%* call the %export_dbms macro with the correct parameters ;
%* all further error trapping is done by the %export_dbms macro ;
%export_dbms(
data=%superq(data)
,path=%superq(path)
,dbms=spss
,replace=%superq(replace)
,label=%superq(label)
)
%mend;
/******* END OF FILE *******/