Friday, November 11, 2011

some general sas questions-part-1

These are the first of the series of the general sas language questions i am posting.

Q1#What are the components of the sas language?
These are the following components of SAS language
1.sas files
2.sas datasets
3.external files
4.DBMS FILES
5.SAS language elements:(data steps and proc steps)
6.sas macro facility

Q2:Different types of sas sessions
1#SAS windowing environment
2#Interactive line mode
3#Noninteractive mode
4#Batch (or background) mode
5# Objectserver mode(sas runs as an IOM server)

Q3#How can you avoid specifying option everytime you invoke sas.
By placing SAS system options in a configuration file,
you can avoid having to specify the options every time that you invoke SAS.
in other words using defaults options.

Q4#HOW many ways SAS allows you to access your input data remotely
Ans;In the following ways:
1.SAS catalog :specifies the access method that enables you to reference a SAS catalog as an external file.FTP specifies the access method that enables you to use File
Transfer Protocol (FTP): to read from or write to a file fromany host computer that is connected to a network with an FTP server running.
2.TCP/IP:socket specifies the access method that enables you toread from or write to a Transmission Control Protocol/Internet Protocol (TCP/IP) socket.
3.URL: specifies the access method that enables you to use the uniform resourcelocator (URL) to read from and write to a file from any host computer that is connected to a network with a URL server running.

Q5#What are the different sources of input data in your sas program.
1# SAS datasets (sas datasets sas views)
2# Raw data (external files and instream data)
3# Remote access:allows you to read input data from nontraditional sources
   such as a TCP/IP socket or a URL. SAS treats this data as if it were coming from an external file.

Q6#How many and what are the types of missing values
numeric
character
special numeric

Q7#How to Check for Missing Values in a DATA Step
You can use the N and NMISS functions to return the number of nonmissing and missing values,
 respectively, from a list of numeric arguments.
When you check for ordinary missing numeric values, you can use code that is similar to the following:
if numvar=. then do;
If your data contains special missing values,
you can check for either an ordinary or special missing value with a statement that is similar to the following:
if numvar<=.z then do;
To check for a missing character value, you can use a statement that is similar to the following:
if charvar=’ ’ then do;
The MISSING function enables you to check for either a character or numeric missing value, as in:
if missing(var) then do;
In each case, SAS checks whether the value of the variable in the current observation satisfies
the condition specified. If it does, SAS executes the DO group.

Q8#The following are types of SAS constants(literals):
character
numeric
date, time, and datetime
bit testing.

Q9#How many types of error are there in sas
1.syntax error
Syntax errors occur when program statements do not conform to the rules of the SAS language.
2.semantic error
Semantic errors occur when the form of the elements in a SAS statement is correct,
but the elements are not valid for that usage.
3.Execution type error
Execution-time errors are errors that occur when SAS executes a program that processes data values.
4.out-of-resource-condition
An execution-time error can also occur when you encounter an out-of-resources condition,
such as a full disk, or insufficient memory for a SAS procedure to complete.
5.Data errors
Data errors occur when some data values are not appropriate for the SAS statements
that you have specified in the program. For example, if you define a variable as numeric,
but the data value is actually character,
6.Macro related errors
macro compile time and macro execution-time errors, generated when you use the macro facility itself
errors in the SAS code produced by the macro facility.

Q10#What to do If you want processing to stop when a statement in a DATA step has a syntax error?
you can enable SAS to enter syntax check mode. You do this by setting the SYNTAXCHECK system option in batch or non-interactive mode, or by setting the DMSSYNCHK system option in the windowing environment.

Q11#How to make sas process multiple errors
You can use the ERRORABEND system option to do this.

No comments:

Post a Comment