c*****s 发帖数: 180 | 1 Default Autocall Library
SAS provides several macros in a default autocall library for you. Some of
the macros in the autocall library that SAS provides are listed here.
Macro Syntax Purpose
%LOWCASE(argument) converts letters in its argument from uppercase to
lowercase
%QLOWCASE(argument) converts letters in its argument from uppercase to
lowercase, and returns a result that masks special characters and mnemonic
operators
%LEFT(argument) removes leading blanks from the argument
%TR |
c*****s 发帖数: 180 | 2 Accessing Autocall Macros
Remember that an autocall library is either a SAS catalog, an external
directory, or a partitioned data set. This is true both for the default
autocall library that SAS supplies and for autocall libraries that you
create.
In order to access a macro definition that is stored in an autocall library,
you must use two SAS system options, as follows:
* The MAUTOSOURCE system option must be specified.
* The SASAUTOS system option must be set to identify the location o |
c*****s 发帖数: 180 | 3 Accessing Autocall Macros
Remember that an autocall library is either a SAS catalog, an external
directory, or a partitioned data set. This is true both for the default
autocall library that SAS supplies and for autocall libraries that you
create.
In order to access a macro definition that is stored in an autocall library,
you must use two SAS system options, as follows:
* The MAUTOSOURCE system option must be specified.
* The SASAUTOS system option must be set to identify the location o |
c*****s 发帖数: 180 | 4 Write a statement that correctly sets the SASAUTOS system option so that the
source library C:\Myautolib is concatenated with the default libraries that
the fileref Sasautos points to. Assume that no fileref has been created to
point to this directory. |
c*****s 发帖数: 180 | 5 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
c*****s 发帖数: 180 | 6
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 7 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
c*****s 发帖数: 180 | 8 Solution to guided practice:
1. Submit the program and examine the output. Notice that the title is
all in lowercase.
2. Read through the messages that were written to the SAS log in Step 1.
Look for the line that says MLOGIC(LOWCASE): This macro was compiled from...
The pathname that is listed is an autocall library.
3. Follow the instructions to browse through the autocall macros that
have been provided for you. |
c*****s 发帖数: 180 | 9 The Stored Compiled Macro Facility
Remember that when a macro is compiled, it is stored in the temporary SAS
catalog Work.Sasmacr by default. You can also store compiled macros in a
permanent SAS catalog. Then you can use the Stored Compiled Macro Facility
to access permanent SAS catalogs that contain compiled macros.
There are several advantages to using stored compiled macros:
* SAS does not need to compile a macro definition when a macro call is
made.
* Session-compiled macros and the |
c*****s 发帖数: 180 | 10 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
|
|
c*****s 发帖数: 180 | 11 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
c*****s 发帖数: 180 | 12
Using Stored Compiled Macros
The Stored Compiled Macro Facility
Remember that when a macro is compiled, it is stored in the temporary SAS
catalog Work.Sasmacr by default. You can also store compiled macros in a
permanent SAS catalog. Then you can use the Stored Compiled Macro Facility
to access permanent SAS catalogs that contain compiled macros.
There are several advantages to using stored compiled macros:
* SAS does not need to compile a macro definition when a macro call is
made
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 13 Using Stored Compiled Macros (continued)
Creating a Stored Compiled Macro
To create a permanently stored compiled macro, you must
1. assign a libref to the SAS library in which the compiled macro will be
stored
2. set the system options MSTORED and SASMSTORE=libref
3. use the STORE option in the %MACRO statement when you submit the macro
definition.
General form, macro definition with STORE option:
%MACRO macro-name <(parameter-list)> /STORE
;
|
c*****s 发帖数: 180 | 14 Example
Suppose you want to store the Words macro in compiled form in a SAS library.
This example shows the macro definition for Words. The macro takes a text
string, divides it into words, and creates a series of macro variables to
store each word.
Notice that the STORE option is used in the macro definition so that Words
will be permanently stored as a compiled macro, as follows:
libname macrolib 'c:\storedlib';
options mstored sasmstore=macrolib;
%macro words(text,root=w,delim=
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 15 What system options must you specify in order to store a compiled macro
permanently?
MAUTOSOURCE and MSTORED
MSTORED and SASAUTOS
MSTORED and SASMSTORE
MAUTOSOURCE and SASAUTOS
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 16 Complete the following code so that the macro Prtlast will be compiled and
stored in Macrolib.
libname macrolib 'c:\storedlib';
options mstored sasmstore=macrolib;
%macro
%if &syslast ne _NULL_%then %do;
proc print data=&syslast(obs=5);
title "Listing of &syslast data set";
run;
%end;
%else
%put No data set has been created yet.;
%mend;
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 17
Using Stored Compiled Macros (continued)
Accessing Stored Compiled Macros
In order to access a stored compiled macro, you must
1. assign a libref to the SAS library that contains a Sasmacr catalog in
which the macro was stored
2. set the system options MSTORED and SASMSTORE=libref
3. call the macro.
Only one permanent catalog containing compiled macros can be accessed at any
given time.
Example
The following program calls the Words macro. Assume that the Words macro was
compi |
c*****s 发帖数: 180 | 18 ?
True or False: You can concatenate multiple locations of stored compiled
macros in the value of the SASMSTORE system option.
True
False |
c*****s 发帖数: 180 | 19
Using Stored Compiled Macros (continued)
The Stored Compiled Macro Facility can be used in conjunction with the
Autocall Facility and with session-compiled macros. When you submit a macro
call such as %words, the macro processor searches for the macro Words as
1. an entry named Words.Macro in the temporary Work.Sasmacr catalog.
2. an entry named Words.Macro in the Libref.Sasmacr catalog. The MSTORED
option must be specified, and the SASMSTORE option must have a value of
Libref.
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 20
Using Stored Compiled Macros (continued)
?
If you have specified the MAUTOSOURCE option, which of the following
correctly describes the process that occurs when you call a macro?
The macro processor checks the autocall library first. If the macro is
not found there, the macro processor looks in a permanent Sasmacr catalog,
if one has been specified. Finally, the macro processor checks the temporary
catalog Work.Sasmacr.
The macro processor checks the permanent Sasmacr c
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 21 Create and access a stored compiled macro.
1. Copy the following program and paste it into the code editing window:
%macro printit(dataset);
proc print data=&dataset(obs=5);
title "Listing of &dataset data set";
run;
%mend;
Modify this macro definition in order to save it permanently in the
Sasuser.Sasmacr catalog. Submit the program.
2. Write a PROC CATALOG step to list the contents of the Sasuser.Sasmacr
catalog. Subm
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 22 Create and access a stored compiled macro.
1. Copy the following program and paste it into the code editing window:
%macro printit(dataset);
proc print data=&dataset(obs=5);
title "Listing of &dataset data set";
run;
%mend;
Modify this macro definition in order to save it permanently in the
Sasuser.Sasmacr catalog. Submit the program.
2. Write a PROC CATALOG step to list the contents of the Sasuser.Sasmacr
catalog. Subm
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 23 This page contains
* a text summary of the material taught in the lesson
* syntax for statements and options
* sample programs
* points to remember.
Text Summary
To go to the page where a task, programming feature, or concept was
presented, select a link.
Understanding Session-Compiled Macros
You can make a macro available to your SAS session by submitting the macro
definition before calling the macro. This creates a session-compiled macro.
Session-compiled macros are deleted fro
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 24
Lesson Quiz
Select the best answer for each question and click Score My Quiz.
1. The %INCLUDE statement
a. can be used to insert the contents of an external file
into a program.
b. will cause a macro definition that is stored in an
external file to be compiled when the contents of that file are inserted
into a program and submitted.
c. can be specified with the SOURCE2 option in order to
write the contents of the external file that
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 25 Correct
1.
The %INCLUDE statement
a. can be used to insert the contents of an external file into a program.
b. will cause a macro definition that is stored in an external file to
be compiled when the contents of that file are inserted into a program and
submitted.
c. can be specified with the SOURCE2 option in order to write the
contents of the external file that is inserted into a program to the SAS log.
d. all of the above.
Correct answer: d
Your answer: d
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 26 Introduction
Some of the SAS data sets that you work with might be quite large. Large
data sets can take a relatively long time to process because, by default,
SAS reads observations in a data set sequentially. For example, assume that
your data set has five hundred observations. In order to read the five-
hundredth observation, SAS first reads the observations numbered 1 through
499, and then reads observation number 500. Sometimes, you might want to
make SAS access specific observations direct
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 27 Introduction
Some of the SAS data sets that you work with might be quite large. Large
data sets can take a relatively long time to process because, by default,
SAS reads observations in a data set sequentially. For example, assume that
your data set has five hundred observations. In order to read the five-
hundredth observation, SAS first reads the observations numbered 1 through
499, and then reads observation number 500. Sometimes, you might want to
make SAS access specific observations direct |
c*****s 发帖数: 180 | 28 Introduction
Some of the SAS data sets that you work with might be quite large. Large
data sets can take a relatively long time to process because, by default,
SAS reads observations in a data set sequentially. For example, assume that
your data set has five hundred observations. In order to read the five-
hundredth observation, SAS first reads the observations numbered 1 through
499, and then reads observation number 500. Sometimes, you might want to
make SAS access specific observations direct
【在 c*****s 的大作中提到】 : : Using Stored Compiled Macros (continued) : Accessing Stored Compiled Macros : In order to access a stored compiled macro, you must : 1. assign a libref to the SAS library that contains a Sasmacr catalog in : which the macro was stored : 2. set the system options MSTORED and SASMSTORE=libref : 3. call the macro. : Only one permanent catalog containing compiled macros can be accessed at any : given time.
|
c*****s 发帖数: 180 | 29 Creating a Systematic Sample from a Known Number of Observations
One type of representative sample that you might want to create is a
systematic sample. A systematic sample contains observations that are chosen
from the original data set at regular intervals. For example, a systematic
sample could contain every hundredth observation of a very large data set.
To create a systematic sample from a data set that has a known number of
observations, you use the POINT= option in the SET statement. |
c*****s 发帖数: 180 | 30
Creating a Systematic Sample from a Known Number of Observations (continued)
By default, SAS reads a data set sequentially, beginning with the first
observation. A DATA step stops processing when SAS reaches the end-of-file
marker after reading the last observation in the data set.
The POINT= option uses direct-access read mode, which means that SAS only
reads those observations that you direct it to read. In direct-access read
mode, SAS does not detect the end-of-file marker. Therefor
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 31 Create a systematic sample from Sasuser.Sale2000, which has a known
number of observations.
1. The Sasuser.Sale2000 data set contains 153 observations. Write a step
to create a systematic sample that contains every twelfth observation of the
Sasuser.Sale2000 data set, starting with the first observation. Output the
sample observations to a temporary data set named Samp1.
2. Write a step to print the Work.Samp1 data set.
3. Submit the program and examine the output |
c*****s 发帖数: 180 | 32 Create a systematic sample from Sasuser.Sale2000, which has a known
number of observations.
1. The Sasuser.Sale2000 data set contains 153 observations. Write a step
to create a systematic sample that contains every twelfth observation of the
Sasuser.Sale2000 data set, starting with the first observation. Output the
sample observations to a temporary data set named Samp1.
2. Write a step to print the Work.Samp1 data set.
3. Submit the program and examine the output
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 33
Creating a Systematic Sample from an Unknown Number of Observations
Sometimes you might not know how many observations are in the original data
set from which you want to create a systematic sample. In order to make a
systematic sample, you need to know the total number of observations in the
original data set so that you can choose observations that are evenly
distributed from it.
You can use the NOBS= option in the SET statement to determine how many
observations there are in a SAS d
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 34
Creating a Systematic Sample from an Unknown Number of Observations (
continued)
?
The variable that is created by the NOBS= option is assigned a value
automatically during compilation of the SET statement
automatically during execution of the SET statement
during compilation of the SET statement, by program statements
during execution of the SET statement, by program statements.
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 35 Creating a Systematic Sample from an Unknown Number of Observations (
continued)
Example
In the last example, you saw a DATA step that selects a systematic sample of
the Sasuser.Revenue data set by reading every tenth observation beginning
with observation number 1, without prior knowledge of the total number of
observations in Sasuser.Revenue. Remember that totobs is assigned a value
that is the total number of observations in Sasuser.Revenue. The variable
pickit has an initial value of 1
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 36 Try It! Create a systematic sample from the Sasuser.Expenses data set,
which has an unknown number of observations.
1. Write a step to create a systematic sample that contains every tenth
observation of the Sasuser.Expenses data set. Assume that you do not know
how many observations are in Sasuser.Expenses. Output the sample
observations to the temporary data set named Samp2.
2. Write a step to print the Work.Samp2 data set.
3. Submit the program and examine the out
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 37 Creating a Random Sample with Replacement
Another type of representative sample that you might want to create is a
random sample. A random sample contains observations that are chosen from
the original data set on a random basis.
When you create a random sample with replacement, it is possible for one
observation to appear in the sample multiple times. You can think of the
original data set as a pool of possible observations that may be chosen for
inclusion in the sample. For each observa
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
w*****9 发帖数: 473 | 38 Create and access a stored compiled macro.
1. Copy the following program and paste it into the code editing window:
%macro printit(dataset);
proc print data=&dataset(obs=5);
title "Listing of &dataset data set";
run;
%mend;
Modify this macro definition in order to save it permanently in the
Sasuser.Sasmacr catalog. Submit the program.
2. Write a PROC CATALOG step to list the contents of the Sasuser.Sasmacr
catalog. Submit
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
w*****9 发帖数: 473 | 39 Create and access a stored compiled macro.
1. Copy the following program and paste it into the code editing window:
%macro printit(dataset);
proc print data=&dataset(obs=5);
title "Listing of &dataset data set";
run;
%mend;
Modify this macro definition in order to save it permanently in the
Sasuser.Sasmacr catalog. Submit the program.
2. Write a PROC CATALOG step to list the contents of the Sasuser.Sasmacr
catalog. Submit
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
w*****9 发帖数: 473 | 40 Create and access a stored compiled macro.
1. Copy the following program and paste it into the code editing window:
%macro printit(dataset);
proc print data=&dataset(obs=5);
title "Listing of &dataset data set";
run;
%mend;
Modify this macro definition in order to save it permanently in the
Sasuser.Sasmacr catalog. Submit the program.
2. Write a PROC CATALOG step to list the contents of the Sasuser.Sasmacr
catalog. Submit
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 41 Creating a Random Sample with Replacement (continued)
Example
The following DATA step creates one observation with one variable named
varone and assigns a random number to it. You can submit this DATA step
multiple times, or in multiple SAS sessions, and varone will have the same
value.
data random1;
varone=ranuni(10);
run;
The following DATA step creates ten observations with one variable named
varone and assigns a random number as a value for varone. You can submit
this
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 42 Creating a Random Sample with Replacement (continued)
You have seen that the RANUNI function generates a random number between 0
and 1. However, in order to create a random sample, you need to generate a
random integer that will match one of the observation numbers in the
original data set.
Using the CEIL Function
You can use the CEIL function in conjunction with the RANUNI function to
generate a random integer.
General form, CEIL function:
CEIL (argument)
where argument is numeric.
T
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 43 question
Write an expression that will generate a random integer between 1 and 10
. Use 0 as the seed to generate your integer.
【在 c*****s 的大作中提到】 : Creating a Random Sample with Replacement (continued) : You have seen that the RANUNI function generates a random number between 0 : and 1. However, in order to create a random sample, you need to generate a : random integer that will match one of the observation numbers in the : original data set. : Using the CEIL Function : You can use the CEIL function in conjunction with the RANUNI function to : generate a random integer. : General form, CEIL function: : CEIL (argument)
|
c*****s 发帖数: 180 | 44 Now that you have seen how to use the CEIL function in conjunction with the
RANUNI function, let's take a look at how to use these functions in a DATA
step to create a random sample. You use the CEIL and RANUNI functions
together to generate a random integer that is assigned as a value for the
variable to which the POINT= option points.
Example
In the following example, the CEIL and RANUNI functions are used together in
the assignment statement for pickit, which is the variable that is pointed
t
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 45 Create a random sample with replacement of 25 employees from the
Sasuser.Salcomps data set to analyze their current salaries.
1. Write a program that will generate a random sample of 25 employees'
information from Sasuser.Salcomps and output it to a temporary data set
named Rsamp1.
2. Add a step to print the new Work.Rsamp1 data set. Submit the program
and examine the output.
3. Revise the program so that the sample observations are output to two
different tempora
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 46 Creating a Random Sample without Replacement
You can also create a random sample without replacement. A sample without
replacement cannot contain duplicate observations because after an
observation is chosen from the original data set and output to the sample,
it is programmatically excluded from being chosen again.
Example
You can use a DO WHILE loop to avoid replacement as you create your random
sample. In the following example,
* Sasuser.Sale2000 is the original data set.
* samp
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 47 Create a random sample of the Sasuser.Salcomps data set, without
replacement.
1. Write another program to create a random sample of 25 observations
from the Sasuser.Salcomps data set. This time, include a statement in your
program that will ensure that no observation from Sasuser.Salcomps can be
included in the sample more than once, and output the sample to a temporary
data set named Rsamp2.
2. Add a step to print the new Work.Rsamp2 data set. Submit the program
and
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 48 Using Indexes
An index can help you quickly locate one or more particular observations
that you want to read. An index is an optional file that you can create for
a SAS data set in order to specify the location of observations based on
values of one or more key variables. Indexes can provide direct access to
observations in SAS data sets to
* yield faster access to small subsets of observations for WHERE
processing
* return observations in sorted order for BY processing
* perfo
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 49
Using Indexes
An index can help you quickly locate one or more particular observations
that you want to read. An index is an optional file that you can create for
a SAS data set in order to specify the location of observations based on
values of one or more key variables. Indexes can provide direct access to
observations in SAS data sets to
* yield faster access to small subsets of observations for WHERE
processing
* return observations in sorted order for BY processing
* pe
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 50 To create an index at the same time that you create a data set, use the
INDEX= data set option in the DATA statement.
General form, DATA statement with the INDEX= option:
DATA SAS-data-file-name (INDEX=
(index-specification-1<...index-specification-n>))
;
where
* SAS-data-file-name is a valid SAS data set name
* index-specification for a simple index is the name of the key variable
* index-specification for a composite index is (index-name=(variable-1..
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 51 Complete the following statement to create a composite index named Fromto on
the output data set that is based on the key variables Origin and Dest.
data flights
set sasuser.revenue;
run;
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 52
Creating Indexes in the DATA Step (continued)
When you create or use an index, you might want to verify that it has been
created or used correctly. To display information in the SAS log concerning
index creation or index usage, set the value of the MSGLEVEL= system option
to I.
General form, MSGLEVEL= system option:
OPTIONS MSGLEVEL= N | I;
where
* N prints notes, warnings, and error messages only. This is the default.
* I prints additional notes or INFO messages pertaining
【在 c*****s 的大作中提到】 : Creating a Random Sample without Replacement : You can also create a random sample without replacement. A sample without : replacement cannot contain duplicate observations because after an : observation is chosen from the original data set and output to the sample, : it is programmatically excluded from being chosen again. : Example : You can use a DO WHILE loop to avoid replacement as you create your random : sample. In the following example, : * Sasuser.Sale2000 is the original data set. : * samp
|
c*****s 发帖数: 180 | 53 Create an index on the Sasuser.Flighttimes data set in a DATA step.
Caution: Be sure to complete this practice. You'll use the indexes that
you create here in later practices. Submit this SAS program to set up
filerefs for practices. If you have already done this in the current SAS
session, you can skip this task. (This program is the same for all lessons.)
1. Use the DATA step and the INDEX= option to create the Sasuser.
Flighttimes data set and two indexes:
*
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 54 You have seen how to create an index at the same time that you create a data
set. You can also create an index on an existing data set, or delete an
index from a data set. One way to accomplish either of these tasks is to
rebuild the data set. However, rebuilding the data set is not the most
efficient method for managing indexes.
You can use the DATASETS procedure to manage indexes on an existing data set
. This uses fewer resources than it would to rebuild the data set. You use
the MODIFY state
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 55 You have seen how to create an index at the same time that you create a data
set. You can also create an index on an existing data set, or delete an
index from a data set. One way to accomplish either of these tasks is to
rebuild the data set. However, rebuilding the data set is not the most
efficient method for managing indexes.
You can use the DATASETS procedure to manage indexes on an existing data set
. This uses fewer resources than it would to rebuild the data set. You use
the MODIFY state
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 56 Complete the following step to create a new simple index on Sasuser.Revenue
that is based on the key variable Date.
proc datasets library=sasuser nolist;
modify revenue;
index delete flightid;
quit;
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 57 Use PROC DATASETS to create an index on the existing Sasuser.Empdata
data set.
1. Write a PROC DATASETS step to create a simple index on the existing
Sasuser.Empdata data set that is named Hiredate and that is based on the key
variable Hiredate. Submit the program and examine any messages that are
written to the SAS log.
2. Revise the program to delete the Hiredate index. Add a statement that
will create an index named Name that is based on the concatenation of the
v
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 58 You can also create indexes on or delete indexes from an existing data set
within a PROC SQL step. The CREATE INDEX statement enables you to create an
index on a data set. The DROP INDEX statement enables you to delete an index
from a data set.
General form, PROC SQL to create and delete an index:
PROC SQL;
CREATE INDEX index-name
ON table-name(column-name-1<...,column-name-n>);
DROP INDEX index-name FROM table-name ;
QUIT;
where
* inde
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 59 Complete the following step to create a new simple index on Sasuser.Revenue
that is based on the key variable Date.
proc sql;
on sasuser.revenue(date);
quit;
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 60 Create an index on the Sasuser.Expenses data set using PROC SQL.
1. Write a PROC SQL step to create an index named Date on the Sasuser.
Expenses data set. Date should be a simple index that is based on the key
variable Date. Submit the program and examine any messages that are written
to the SAS log.
2. Revise the PROC SQL step to delete the Date index and create a new
index named FlightDate that concatenates the values of the key variables
FlightID and Date. Submit the pr
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 61 Indexes are stored in the same SAS data library as the data set that they
index, but in a separate SAS file from the data set. Index files have the
same name as the associated data file, and have a member type of INDEX.
There is only one index file per data set; all indexes for a data set are
stored together in a single file.
The following image shows the relationship of SAS data set files and SAS
index files in a Windows operating environment. Notice that although they
have different file exten
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 62 Information about indexes is stored in the descriptor portion of the data
set. You can use either the CONTENTS procedure or the CONTENTS statement in
PROC DATASETS to list information from the descriptor portion of a data set.
Output from the CONTENTS procedure or from the CONTENTS statement in PROC
DATASETS contains the following information about the data set:
* general and summary information
* engine/host dependent information
* alphabetic list of variables and attributes
* a
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 63 Documenting and Maintaining Indexes (continued)
Remember that indexes are stored in a separate SAS file. When you perform
maintenance tasks on a data set, there might be resulting effects on the
index file. If you alter the variables or values within a data set, there
might be a resulting effect on the value/identifier pairs within a
particular index.
The following table describes the effects on an index or an index file that
result from several common maintenance tasks.
Task Effect
Ad
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 64 Copying Data Sets
You might want to copy an indexed data set to a new location. You can copy a
data set with the COPY statement in a PROC DATASETS step. When you use the
COPY statement to copy a data set that has an index associated with it, a
new index file is automatically created for the new data file.
General form, PROC DATASETS with the COPY statement:
PROC DATASETS LIBRARY=old-libref ;
COPY OUT=new-libref;
SELECT SAS-data-set-name;
QUIT;
where
* ol
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 65 Renaming Data Sets
Another common task is to rename an indexed data set. To preserve the index,
you can use the CHANGE statement in PROC DATASETS to rename a data set. The
index file will be automatically renamed as well.
General form, PROC DATASETS with the CHANGE statement:
PROC DATASETS LIBRARY=libref ;
CHANGE old-data-set-name = new-data-set-name;
QUIT;
where
* libref names the SAS library where the data set is stored
* old-data-set-name is the current name
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 66 Renaming Data Sets
Another common task is to rename an indexed data set. To preserve the index,
you can use the CHANGE statement in PROC DATASETS to rename a data set. The
index file will be automatically renamed as well.
General form, PROC DATASETS with the CHANGE statement:
PROC DATASETS LIBRARY=libref ;
CHANGE old-data-set-name = new-data-set-name;
QUIT;
where
* libref names the SAS library where the data set is stored
* old-data-set-name is the current name
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 67 Renaming Variables
You have seen how to use PROC DATASETS to rename an indexed data set.
Similarly, you might want to rename one or more variables within an indexed
data set. In order to preserve any indexes that are associated with the data
set, you can use the RENAME statement in the DATASETS procedure to rename
variables.
General form, PROC DATASETS with the RENAME statement:
PROC DATASETS LIBRARY=libref ;
MODIFY SAS-data-set-name;
RENAME old-var-name-1 = new
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 68 Select the best answer for each question and click Score My Quiz.
1. The variable that is created by the POINT= option is assigned a value
a. automatically during compilation of the DATA step.
b. automatically during execution of the DATA step.
c. during compilation of the DATA step, by program
statements.
d. during execution of the DATA step, by program statements.
2. Which of the following programs correctly creates a sy
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 69 1.
The variable that is created by the POINT= option is assigned a value
a. automatically during compilation of the DATA step.
b. automatically during execution of the DATA step.
c. during compilation of the DATA step, by program statements.
d. during execution of the DATA step, by program statements.
Correct answer: d
The POINT= option in the SET statement names a variable. You must use
program statements to assign a value to this variable during execution of
the
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 70 You already know that you can use a FILENAME statement to associate a
fileref with a single raw data file. You can also use a FILENAME statement
to concatenate raw data files by assigning a single fileref to the raw data
files that you want to combine.
General form, FILENAME statement:
FILENAME fileref ('external-file1' 'external-file2' ...'external-filen')
;
where
* fileref is any SAS name that is eight characters or fewer.
* 'external-file' is the physical name of an external file. |
|
|
c*****s 发帖数: 180 | 71 question
Write a statement to assign the fileref Revenue to the raw data files
Qtr3.dat and Qtr4.dat. The files are stored in the C:\Data directory in the
Windows operating environment.
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 72 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 5 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement
You can make the process of concatenating raw data files more flexible by
using an INFILE statement with the FILEVAR= option. The FILEVAR= option
enables you to dynamically change the currently opened input file to a new
input file.
General form, INFILE statement with the FILEVAR= option:
INFILE file-specification FILEVA |
c*****s 发帖数: 180 | 73 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 6 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
Assigning the Names of the Files to Be Read
The next step is to assign the names of the three files to be read to the
variable nextfile:
data work.quarter;
infile temp filevar=nextfile;
input Flight $ Origin $ Dest $
Date : date9. RevCargo : comma15.2;
In this case, let's use th
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 74 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 7 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
Using the COMPRESS Function
Note the space between month and 9 in c:\sasuser\month 9.dat. You can
eliminate the space by using the COMPRESS function.
When i= nextfile=
9
c:\sasuser\month 9.dat
10
c:\sasuser\month10.dat
11
c:\sasuser\month11.dat
General form, COMPRESS function:
COMPRESS(source,
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 75 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 8 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
Using the END= Option
When you read past the last record in a raw data file, the DATA step
normally stops processing. In this case, you need to read the last record in
the first two raw data files. However, you do not want to read past the
last record in either of those files because the DATA step will stop
proce
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 76 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 10 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
?
Which of the following statements correctly assigns the names of the raw
data files Movies_April.dat, Movies_May.dat, and Movies_June.dat to the
variable nextfile? The values of i are April, May, and June.
nextfile="c:\flights\movies_"
!!compress(put(i,$4.)!!".dat",' ');
nextfile="c:\f
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 77 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 11 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
question
Write an assignment statement that uses the COMPRESS function to remove the
character string Special from the values of the variable Menu. Name the new
variable Var.
Copyright© 2005 SAS Institute Inc., Cary, NC, USA. All rights
reserved.
Terms of Use & Legal Information | Pr
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 78 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 14 of 28
backnextlesson menuLearning Pathhelp menu
Using an INFILE Statement (continued)
Using the INTNX Function
In the previous example the current month was October. What happens if the
current month is January or February?
Suppose the current date is February 16, 2003. Using the following program,
the values for midmon (January) and lastmon (December) would be 1 and 0
respectively. Since there i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 79 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 18 of 28
backnextlesson menuLearning Pathhelp menu
Appending SAS Data Sets
Now that you have seen several methods for concatenating raw data files, let
's take a look at how you can use the APPEND procedure to concatenate two
SAS data sets.
General form, PROC APPEND:
PROC APPEND BASE=SAS-data-set DATA=SAS-data-set;
RUN;
where
* BASE=SAS-data-set names the data set to which you want to ad
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 80 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 19 of 28
backnextlesson menuLearning Pathhelp menu
Appending SAS Data Sets (continued)
Using the FORCE Option
In the previous example, the DATA= data set (Work.Capacity) contained fewer
variables than the BASE= data set (Work.Cap2001). However, you may need to
append data sets when the DATA= data set contains more variables than the
BASE= data set.
You must use the FORCE option with the APPEND proce
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 81 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 20 of 28
backnextlesson menuLearning Pathhelp menu
Appending SAS Data Sets (continued)
Appending Variables with Different Lengths
If the DATA= data set contains variables that are longer than the variables
in the BASE= data set, the FORCE option must be used with PROC APPEND. Using
the FORCE option enables you to append the data sets. However, the DATA=
variable values will be truncated.
Example
In
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 82 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 21 of 28
backnextlesson menuLearning Pathhelp menu
Appending SAS Data Sets (continued)
Appending Variables with Different Types
If the DATA= data set contains a variable that does not have the same type
as the corresponding variable in the BASE= data set, the FORCE option must
be used with PROC APPEND. Using the FORCE option enables you to append the
data sets. However, missing values are assigned t
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 83 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 23 of 28
backnextlesson menuLearning Pathhelp menu
Appending SAS Data Sets (continued)
?
Is it necessary to use the FORCE option if you are using PROC APPEND to
append the SAS data set Training.Denver to the SAS data set Training.Raleigh?
Data Set Description for Training.Raleigh
Variable
Type
Length
Division
num
8
EmployeeID
num
8
Name
num
8
Extension
num
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 84 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 25 of 28
backnextlesson menuLearning Pathhelp menu
Additional Features
In addition to the methods for appending raw data files that were discussed
earlier in this lesson, you can also append raw data files using a SAS data
set or an external file that contains the names of the raw data files to be
appended.
Storing Raw Data Filenames in a SAS Data Set
In the following program, five raw data files, R
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 85 SAS OnlineTutor®: Advanced SAS®
Combining Data Vertically 25 of 28
backnextlesson menuLearning Pathhelp menu
Additional Features
In addition to the methods for appending raw data files that were discussed
earlier in this lesson, you can also append raw data files using a SAS data
set or an external file that contains the names of the raw data files to be
appended.
Storing Raw Data Filenames in a SAS Data Set
In the following program, five raw data files, R
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 86 1.
Which of the following statements associates the fileref OnSale with the
raw data files London.dat, Paris.dat, and Zurich.dat? The files are stored
in the C:\Routes\New directory in the Windows operating environment.
a.
filename onsale (c:\routes\new\london.dat,
c:\routes\new\paris.dat,
c:\routes\new\zurich.dat);
b.
filename onsale 'c:\routes\new\london.dat'
'c:\routes\new\paris.dat'
'c:\routes\new\zurich.dat';
c.
filename onsale ('c:\routes\new\london.dat'
'c:
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 87 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 2 of 47
backnextlesson menuLearning Pathhelp menu
Reviewing Terminology
Before examining the various techniques for combining data horizontally, let
's review some of the terminology that this lesson uses. The table below
lists important terms that you will need to know, along with their
definitions.
Term Definition
combining data horizontally A technique in which information is
retrieved
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 88 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 3 of 47
backnextlesson menuLearning Pathhelp menu
Reviewing Terminology (continued)
Relationships between Input Data Sources
One important factor to consider when you perform a table lookup is the
relationship between the input data sources. In order to combine data
horizontally, you must be able to match observations from each input data
source. For example, there might be one or more variables t
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 89 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 4 of 47
backnextlesson menuLearning Pathhelp menu
Reviewing Terminology (continued)
?
Examine the two data sets shown below.
SAS Data Set A
Num VarOne
2458 07OCT2003
2462 19NOV2001
2501 30MAR2001
SAS Data Set B
Num VarTwo
2458 itemA
2462 itemB
2462 itemC
2501 itemA
Which term best describes the relationship between these data sets?
one-to-one
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 90 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 5 of 47
backnextlesson menuLearning Pathhelp menu
Working with Lookup Values Outside of SAS Data Sets
Remember that it is not necessary for your lookup table to be a SAS data set
. Suppose you want to combine the data from your base table with lookup
values that are not stored in a SAS data set. You can use the following
techniques to hard-code lookup values into your program:
* the IF-THEN/EL |
|
|
c*****s 发帖数: 180 | 91 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 6 of 47
backnextlesson menuLearning Pathhelp menu
Working with Lookup Values Outside of SAS Data Sets (continued)
SAS Arrays
You should be familiar with the syntax and use of the ARRAY statement. With
the ARRAY statement, you can either hard-code your lookup values into the
program, or you can read them into the array from a data set. Elements of a
SAS array are referenced positionally. That is, y
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 92 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 7 of 47
backnextlesson menuLearning Pathhelp menu
Working with Lookup Values Outside of SAS Data Sets (continued)
User-Defined SAS Formats
You should be familiar with the syntax and use of the FORMAT procedure with
the VALUE statement. You can associate a format with a variable permanently
by using a FORMAT or ATTRIB statement in a DATA step or PROC step that
creates a SAS data set. In a DATA step
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 93 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 7 of 47
backnextlesson menuLearning Pathhelp menu
Working with Lookup Values Outside of SAS Data Sets (continued)
User-Defined SAS Formats
You should be familiar with the syntax and use of the FORMAT procedure with
the VALUE statement. You can associate a format with a variable permanently
by using a FORMAT or ATTRIB statement in a DATA step or PROC step that
creates a SAS data set. In a DATA step
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 94 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 8 of 47
backnextlesson menuLearning Pathhelp menu
Working with Lookup Values Outside of SAS Data Sets (continued)
?
Select the statement below that is true.
If the lookup values are not stored in a SAS data set, you must use the
IF-THEN/ELSE statement to perform a table lookup operation.
You can use either the IF-THEN/ELSE statement or the ARRAY statement to
return multiple lookup
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 95 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 9 of 47
backnextlesson menuLearning Pathhelp menu
Try It! Combine the first five observations in the Sasuser.Empdata data
set with a list of lookup values that are not stored in a data set.
1. Write a program that uses the IF-THEN/ELSE statement to combine the
employee birthdates that are recorded in the list below with the first five
observations of the Sasuser.Empdata data s
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 96 SAS OnlineTutor®: Advanced SAS®
Combining Data Horizontally 16 of 47
backnextlesson menuLearning Pathhelp menu
Using PROC SQL to Join Data
The SQL Procedure
Another method that you can use to join data sets that do not have a common
variable is the SQL procedure. You should already be familiar with using
PROC SQL to create a table from the results of an inner join.
In a PROC SQL step, you can choose from each input data set only the
specific variables that
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 97 SAS OnlineTutor®: Advanced SAS®
Modifying SAS Data Sets and Tracking Changes 51 of 60
backnextlesson menuLearning Pathhelp menu
Try It! Create generation data sets for the Jobhstry data set.
Caution You must complete this practice to do the next practice in this
lesson.
Note Because this data set is used in other practices and lessons, you
must copy it to the Work library so that the original data in the Sasuser
library is not mod
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 98 SAS OnlineTutor®: Advanced SAS®
Modifying SAS Data Sets and Tracking Changes 53 of 60
backnextlesson menuLearning Pathhelp menu
Processing Generation Data Sets (continued)
How Generation Numbers Change
When you use the GENNUM= option, you can refer to either the absolute or
relative generation number. It's helpful to understand how generation
numbers change so that you can identify the generation you want to process.
First, let's take a look at how SAS nam
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 99 SAS OnlineTutor®: Advanced SAS®
Modifying SAS Data Sets and Tracking Changes 55 of 60
backnextlesson menuLearning Pathhelp menu
Processing Generation Data Sets (continued)
You have learned that you use PROC DATASETS to initiate generation data sets
on an existing SAS data set. Once you have created generation data sets,
you can use PROC DATASETS to perform management tasks such as
* deleting all or some of the generations
* renaming an entire gener
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 100 SAS OnlineTutor®: Advanced SAS®
Modifying SAS Data Sets and Tracking Changes 58 of 60
backnextlesson menuLearning Pathhelp menu
Lesson Summary
This page contains
* a text summary of the material taught in the lesson
* syntax for statements and options
* sample programs
* points to remember.
Text Summary
To go to the page where a task, programming feature, or concept was
presented, select a link.
Using the MODIFY Statement
When you use the M
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 101 SAS OnlineTutor®: Advanced SAS®
Modifying SAS Data Sets and Tracking Changes 59 of 60
backnextlesson menuLearning Pathhelp menu
Lesson Quiz
Select the best answer for each question and click Score My Quiz.
1. Which type of integrity constraint would you place on the variable
StoreID to ensure that there are no missing values and that there are no
duplicate values?
a. UNIQUE
b. CHECK
c. PRIMARY KEY
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 102 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 103 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 104 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 105 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 106 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 107 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 108 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 109 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 110 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 111 Quiz Score: 80% Your score
You answered 8 out of 10 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page,
the information appears in the original browser window.
Question #
1
2
3
4
5
6
7
8
9
10
Correct /
Incorrect
Correct
Correct Correct Incorrect Correct Correct Correct
Correct Incorrect Correct
Correct
1.
Which type of i
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 112 Threaded Processing
If your site has installed SAS 9.1 or later, then you should consider
whether you can optimize the performance of your SAS programs by taking
advantage of the new SAS threaded technology. This technology enables you to
work with virtually any volume of data efficiently and to exploit your
hardware's capabilities to the maximum. Threading improves performance by
enabling a single SAS session to use multiple I/O channels and to take
advantage of hardware that has multiple CPUs,
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 113 Threaded Processing
If your site has installed SAS 9.1 or later, then you should consider
whether you can optimize the performance of your SAS programs by taking
advantage of the new SAS threaded technology. This technology enables you to
work with virtually any volume of data efficiently and to exploit your
hardware's capabilities to the maximum. Threading improves performance by
enabling a single SAS session to use multiple I/O channels and to take
advantage of hardware that has multiple CPUs,
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 114 Threaded Processing
If your site has installed SAS 9.1 or later, then you should consider
whether you can optimize the performance of your SAS programs by taking
advantage of the new SAS threaded technology. This technology enables you to
work with virtually any volume of data efficiently and to exploit your
hardware's capabilities to the maximum. Threading improves performance by
enabling a single SAS session to use multiple I/O channels and to take
advantage of hardware that has multiple CPUs,
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 115 SAS OnlineTutor®: Advanced SAS®
Introduction to Efficient SAS Programming 2 of 11
backnextlesson menuLearning Pathhelp menu
Overview of Computing Resources
Running a SAS program requires the programmer and the computer to perform a
variety of tasks. The programmer must write, submit, and maintain the
program. The computer must load the required SAS software components and the
program into memory, compile the program, locate the data that the program
requir
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 116 SAS OnlineTutor®: Advanced SAS®
Introduction to Efficient SAS Programming 3 of 11
backnextlesson menuLearning Pathhelp menu
Assessing Efficiency Needs at Your Site
The first step in making an effective decision about how to optimize your
SAS programs is to assess your site's technical environment, your program(s)
, and your data.
Assessing Your Technical Environment
To determine which resources are scarce or costly at your site, work with
your IT departmen
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 117 SAS OnlineTutor®: Advanced SAS®
Introduction to Efficient SAS Programming 4 of 11
backnextlesson menuLearning Pathhelp menu
Understanding Efficiency Trade-offs
When you are trying to optimize SAS programs, it is important to understand
that there are trade-offs. Decreasing the use of one resource frequently
increases the use of another. The following table shows examples of some
common efficiency trade-offs.
Decreasing usage of this resource ... Might
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 118 SAS OnlineTutor®: Advanced SAS®
Introduction to Efficient SAS Programming 6 of 11
backnextlesson menuLearning Pathhelp menu
Using SAS System Options to Track Resources
You can specify one or more of the SAS system options STIMER, MEMRPT,
FULLSTIMER, and STATS to track and report on resource utilization. The
availability, usage, and functionality of these options vary by operating
environment, as described below:
Option z/OS UNIX and Windows
STIMER
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 119 SAS OnlineTutor®: Advanced SAS®
Introduction to Efficient SAS Programming 8 of 11
backnextlesson menuLearning Pathhelp menu
Using Benchmarks to Compare Techniques
To decide which SAS programming technique is most efficient for a particular
task, you can benchmark (measure and compare) the resource usage for each
technique that you are comparing.
Guidelines for Benchmarking
Your benchmarking is most likely to yield useful results if you follow these
guideli
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 120 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 2 of 21
backnextlesson menuLearning Pathhelp menu
Controlling Page Size and the Number of Buffers
Measuring I/O
Improvement in I/O can come at the cost of increased memory consumption. In
order to understand the relationship between I/O and memory, it is helpful
to know when data is copied to a buffer and where I/O is measured. When you
create a SAS data set using a DATA step,
1. SAS copies the da
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 121 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 3 of 21
backnextlesson menuLearning Pathhelp menu
Controlling Page Size and the Number of Buffers (continued)
Page Size
Think of a buffer as a container in memory that is big enough for only one
page of data. A page
* is the unit of data transfer between the storage device and memory
* includes the number of bytes used by the descriptor portion, the data
values, and any overhead
* is fixe
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 122 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 4 of 21
backnextlesson menuLearning Pathhelp menu
Controlling Page Size and the Number of Buffers (continued)
Reporting Page Size
You can use the CONTENTS procedure or the CONTENTS statement in the DATASETS
procedure to report the page size and the number of pages.
proc contents data=company.order_fact;
run;
Partial PROC CONTENTS Output
Engine/Host Dependent Information
Data Set Page Size
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 123 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 124 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 125 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 126 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 127 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 128 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 129 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 130 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
|
|
c*****s 发帖数: 180 | 131 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 132 SAS OnlineTutor®: Advanced SAS®
Controlling Memory Usage 15 of 21
backnextlesson menuLearning Pathhelp menu
Using the SASFILE Statement (continued)
Bar chart iconComparative Example: Using the SASFILE Statement
Suppose you want to create multiple reports from SAS data files that vary in
size. Using small, medium, and large data files, you can compare the
resource usage when the PRINT, TABULATE, MEANS, and FREQ procedures are used
with and without the SASFI
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|
c*****s 发帖数: 180 | 133 SAS OnlineTutor®: Advanced SAS®
Controlling Data Storage Space 2 of 29
backnextlesson menuLearning Pathhelp menu
Reducing Data Storage Space for Character Variables
One way to reduce the amount of data storage space that you need is to
reduce the length of character data, thereby eliminating wasted space.
Before discussing how to reduce the length of a character variable, let's
look at how SAS assigns lengths to character variables.
How SAS Assigns Lengths
【在 c*****s 的大作中提到】 : Default Autocall Library : SAS provides several macros in a default autocall library for you. Some of : the macros in the autocall library that SAS provides are listed here. : Macro Syntax Purpose : %LOWCASE(argument) converts letters in its argument from uppercase to : lowercase : %QLOWCASE(argument) converts letters in its argument from uppercase to : lowercase, and returns a result that masks special characters and mnemonic : operators : %LEFT(argument) removes leading blanks from the argument
|