Monday 26 December 2016

SAS Enterprise Guide: Explore Data before you start Analysing....

SAS Enterprise Guide: Explore Data before you start Analysing....


 New version of SAS Enterprise Guide 5.1 has some features which really can reduce the significant time of programmer. One of the feature, I like most in SAS enterprise guide is “explore” option in data.
Generally as a programmer, before I start writing any program for reporting, I love to explore my data to understand data in detail. 
 
I search for answers of following questions before writing the programs.
       1)      What variables are available in data sets
       2)      What are their types
       3)      How many distinct values are available  
       4)      What is descriptive statistics for the numeric data
       5)      Will visualizing data makes more sense??

And many more…. Questions answers I get by writing the procedures like PROC FREQ, PROC MEANS, PROC CONTENTS, PROC PRINT etc. and endup spending lots of time.

SAS Enterprise Guide 5.1 have additional option of exploring data before getting in to project window.
All you need to do is go to library and right click on your data to select option “EXPLORE”.

Once you click the explore option from menu, new explorer window will open up which is really good to understand the basics about the data.



It shows all columns by default. On Right hand side DATA Filter is available where you can select only required column or observations by filtering the data. You can also sort the data based on requirement

If you want to select few columns for further understanding, just click on select column option in right hand side and pop up window will open to ask for column to select for display purpose.
Once selected you can click on “view updates” option to get updated result after applying filters.




This small window will show you what all updates are applied and sort order has been specified for those variables as well as properties of the data you are working on.


If you click on second tab in explore window on SAS Enterprise guide 5.1, you will get hell lot for statistics to characterize your data, both for numeric and character variables.

If you click on the graph it gives nice representation of frequency count for character variables.



It also give you output in tabular form same as PROC FREQ procedure


For Numeric variable it also provides the distribution analysis of variables you have selected.


In short, now task became more easy with SAS Enterprise Guide.

Even Lazy programmers now can quickly do analysis without much efforts..

Saturday 24 December 2016

SAS Macro: Top 10 Interview Questions

SAS Macro: Top 10 Interview Questions

1. Can I use SAS functions within the macro facility?
Answer:
Yes, by using the %SYSFUNC macro
function.

Example: %put %sysfunc(date(),worddate20.);

2. What quoting function should I use to mask special characters?

Depends. Use compile-time or execution-time quoting functions for your situation.

Compile-time quoting functions:

 %STR–masks commas, mnemonics, and unmatched quotation marks and parentheses.
 %NRSTR–masks percent signs and ampersands in addition to the other special characters.

Execution-time quoting functions:


 %BQUOTE–masks special characters and mnemonics in resolved values during macro execution.
 %SUPERQ–masks special characters and mnemonics during macro execution. However, it also prevents further resolution of any macros or macro variables.

Example: Unmatched Quotation Mark (‘)
%let singleq=O'neill;
%put &singleq;

Solution: %STR Function
%let singleq=%str(O%'neill)
%put &singleq;

Example: Percent Sign (%)
%let ex=This macro is called %showme;
%put ex=&ex;

log message

20 %let ex= This macro is called %showme;
WARNING: Apparent invocation of macro SHOWME not resolved.
21 %put ex=&ex;
WARNING: Apparent invocation of macro SHOWME not resolved.

Solution: %NRSTR Function
%let ex=%nrstr(This macro is called %showme);
%put ex=&ex;


3. How do I resolve a macro variable within single quotation marks?

Use the %STR and %UNQUOTE
functions.


4. How do I resolve error messages when output that was generated with the MPRINT system option looks fine?


Use the %UNQUOTE function


5. What are the differences between the autocall facility and the stored compiled macro facility?

Autocall Facility


Macro source code is implicitly included and compiled to the WORK.SASMACR catalog.
To use autocall macros, you have to set the MAUTOSOURCE and the SASAUTOS= system options.
The MAUTOSOURCE option activates the autocall facility.
The SASAUTOS= option specifies the autocall library or libraries

Stored Compiled Macro Facility

The stored compiled macro facility provides access to permanent SAS catalogs from which you can invoke compiled macros directly.
To use these stored compiled macros, you have to set the MSTORED and the SASMSTORE= system options.
The MSTORED option searches for the compiled macros in a SAS catalog that you reference with the SASMSTORE= option.
The SASMSTORE= option specifies the libref for the SAS library that contains the stored compiled macros.

6. How do I conditionally execute a macro from within a DATA step?

Use the CALL EXECUTE routine

Example: CALL EXECUTE routine

/* Compile the macro BREAK. The BYVAL */
/* parameter is generated in the CALL */
/* EXECUTE routine. */
%macro break(byval);
data age_&byval;
set sorted(where=(age=&byval));
run;
%mend;
proc sort data=sashelp.class out=sorted;
by age;
run;
options mprint;
data _null_;
set sorted;
by age;
if first.age then call execute(‘%break(‘||age||’)’);
run;


7. Why does my macro variable not resolve?

The macro variable might not resolve for a few reasons:
 macro variable scope: Local macro variables versus global macro variables.
 no step boundary:The DATA step does not have an ending RUN statement before a CALL SYMPUT or a CALL SYMPUTX routine.

Example: No RUN statement before %PUT statement:
data test;
x="MYVALUE";
call symputx('macvar',x);
%put WILL I RESOLVE &macvar?;


 timing issues: a result of using the CALL EXECUTE and CALL SYMPUT routines together.



8. How can I use macros to loop through all files in a directory?

Use the %DO statement


9. Can I use DATA step variables in a %IF-%THEN statement?

No, DATA step variables cannot be used
in %IF-%THEN statements.


10. Why am I getting an error that states that a character operand was found in the %EVAL function?






Basic SAS Interview Questions

1. Steps from raw data to output ….
2. Have you used macros n how are you with them?
3. Can you give me some system option for debugging macro error?
4. Why do you use Macros?
5. How do u create a macro variable?
6. Difference between Local and Global macros
7. Just list various Procs you have used….
8. What is the use of Proc corr?
9. Can you explain Proc Compare?
10. Can you explain Proc Report?
11. Use of Put statement?
12. Say u have x=a+b; and x = sum (a,b); what result is expected?
13. Where do you use proc Formats and label?
14. What do you mean by calculated / derived variable?
15. Getting data from databases such as oracle
16. Which functions are used to convert Numeric to character variables and vice-versa?
17. Proc Univariate advantages.
18. How do you use your statistical skills in your last projects?
19. What's the difference between proc means and function means?
20. How do you use ODS?
21. How do you use MACRO?
22. What's the difference between SQL and MERGE?
23. What would you do with data validation? What's your process?
24. How would you transport data?
25. How would you rank your expertise in SAS Base in a scale of 1 to 10?
26. How would you rank your expertise in using MACRO in a scale of 1 to 10?

Predictive Analytics -Scope

Predictive Analytics -Scope


What is Predictive Analytics?
Predictive analytics is business intelligence technology that produces a predictive score for each customer or other organizational element. Assigning these predictive scores is the job of a predictive model which has, in turn, been trained over your data, learning from the experience of your organization Predictive analytics optimizes marketing campaigns and website behavior to increase customer responses,  conversions and clicks, and to decrease churn. Each customer's predictive score informs actions to be taken with that customer — business intelligence just doesn't get more actionable than that.

Predictive analytics is the branch of data mining concerned with the prediction of future probabilities and trends. The central element of predictive analytics is the predictor, a variable that can be measured for an individual or other entity to predict future behavior. For example, an insurance company is likely to take into account potential driving safety predictors such as age, gender, and driving record when issuing car insurance policies.
Multiple predictors are combined into a predictive model, which, when subjected to analysis, can be used to forecast future probabilities with an acceptable level of reliability. In predictive modeling, data is collected, a statistical model is formulated, predictions are made and the model is validated (or revised) as additional data becomes available. Predictive analytics are applied to many research areas, including meteorology, security, genetics, economics, and marketing

Predictive analytics are used to determine the probable future outcome of an event or the likelihood of a situation occurring. It is the branch of data mining concerned with the prediction of future probabilities and trends. Predictive analytics is used to automatically analyze large amounts of data with different variables; it includes clustering, decision trees, market basket analysis, regression modeling, etc

Applications

• Analytical customer relationship management (CRM)
• Clinical decision support systems
• Collection analytics
• Cross-sell
• Customer retention
• Direct marketing
• Fraud detection
• Portfolio, product or economy level prediction
• Underwriting

Predictive Analytics and Business Intelligence

There seems to be a lot of confusion out there on what predictive analytics really is, and whether traditional business intelligence solutions are able to address such needs. Hopefully what I'm about to write will help clear things up a bit. First off, both BI and predictive analytics have seen tremendous growth, and both deal with making sense of your data. However, traditional business intelligence often falls short of being able to robustly analyze existing data, let alone build predictive and other highly analytical models. Most business intelligence products do a decent job at measuring operational metrics, operational monitoring, reporting and querying. The more modern solutions can also build and maintain scorecards and strategy maps and understand performance against targets at all levels of the organization. (Such as not only measuring turnover within HR, but more esoteric strategic goals of 'becoming an employee centric organization' for which a CEO may be on the hook.) A good BI solution will bring this data together from a variety of data sources without necessarily having to invest in a data warehouse. In other words, BI helps answer the question of "How we are doing."

However, many BI solutions lack the ability to robustly analyze ("Why are we performing this way") and project in the future ("What should we be doing instead"). OLAP--a technology that has been around for a very long time, and which provides analysis at the speed of thought--is still not completely and robustly embraced by all BI vendors.

Second, most BI vendors lack the ability to build models that can project in the future. The bigger players (basically the ones in the Gartner Magic Quadrant) typically do to some extent, and can perform the more basic types of advanced analytics, such as Linear Regression, Least Squares Regression and Predictive Modeling using Multiplicative Analysis. This is probably sufficient in most cases. However, for more sophisticated models and profiling, these vendors typically partner with someone that specializes in this area, such as SPSS.

To tie this all back to the question of BI vs. Predictive Analytics, a metaphor I've heard used to describe the difference goes something like this: if BI is a look in the rearview mirror, predictive analytics is the view out the windshield.

So if your needs require BI with robust analytics, your best bet is to look up the BI and Performance Management vendors in Gartner's Magic Quadrant and understand whether they can help you. In certain (and relatively rare) cases you will need to resort to supplementing the BI solution with SPSS or SAS analytics.

The market is witnessing an unprecedented shift in business intelligence (BI), largely because of technological innovation and increasing business needs. The latest shift in the BI market is the move from traditional analytics to predictive analytics. Although predictive analytics belongs to the BI family, it is emerging as a distinct new software sector. Analytical tools enable greater transparency, and can find and analyze past and present trends, as well as the hidden nature of data. However, past and present insight and trend information are not enough to be competitive in business. Business organizations need to know more about the future, and in particular, about future trends, patterns, and customer behavior in order to understand the market better. To meet this demand, many BI vendors developed predictive analytics to forecast future trends in customer behavior, buying patterns, and who is coming into and leaving the market and why.
Traditional analytical tools claim to have a real 360° view of the enterprise or business, but they analyze only historical data—data about what has already happened. Traditional analytics help gain insight for what was right and what went wrong in decision-making. Today's tools merely provide rear view analysis.

However, one cannot change the past, but one can prepare better for the future and decision makers want to see the predictable future, control it, and take actions today to attain tomorrow's goals.
Predictive Analytics and Data Mining The future of data mining lies in predictive analytics. However, the terms data mining and data extraction are often confused with each other in the market. Data mining is more than data extraction It is the extraction of hidden predictive information from large databases or data warehouses. Data mining, also known as knowledge-discovery in databases, is the practice of automatically searching large stores of data for patterns. To do this, data mining uses computational techniques from statistics and pattern recognition.

On the other hand, data extraction is the process of pulling data from one data source and loading them into a targeted database; for example, it pulls data from source or legacy system and loading data into standard database or data warehouse. Thus the critical difference between the two is data mining looks for patterns in data.

A predictive analytical model is built by data mining tools and techniques. Data mining tools extract data by accessing massive databases and then they process the data with advance algorithms to find hidden patterns and predictive information. Though there is an obvious connection between statistics and data mining, because methodologies used in data mining have originated in fields other than statistics.
Data mining sits at the common borders of several domains, including data base management, artificial intelligence, machine learning, pattern recognition, and data visualization. Common data mining techniques include artificial neural networks, decision trees, genetic algorithms, nearest neighbor method, and rule induction.

Predictive Analytics-The Future Business Intelligence

The market is witnessing an unprecedented shift in business intelligence (BI), largely because of technological innovation and increasing business needs. The latest shift in the BI market is the move from traditional analytics to predictive analytics. Although predictive analytics belongs to the BI family, it is emerging as a distinct new software sector.

Analytical tools enable greater transparency, and can find and analyze past and present trends, as well as the hidden nature of data. However, past and present insight and trend information are not enough to be competitive in business. Business organizations need to know more about the future, and in particular, about future trends, patterns, and customer behavior in order to understand the market better. To meet this demand, many BI vendors developed predictive analytics to forecast future trends in customer behavior, buying patterns, and who is coming into and leaving the market and why.

Traditional analytical tools claim to have a real 360° view of the enterprise or business, but they analyze only historical data—data about what has already happened. Traditional analytics help gain insight for what was right and what went wrong in decision-making. Today's tools merely provide rear view analysis.
However, one cannot change the past, but one can prepare better for the future and decision makers want to see the predictable future, control it, and take actions today to attain tomorrow's goals.

A Microscopic and Telescopic View of Your Data

Predictive analytics employs both a microscopic and telescopic view of data allowing organizations to see and analyze the minute details of a business, and to peer into the future. Traditional BI tools cannot accomplish this functionality. Traditional BI tools work with the assumptions one creates, and then will find if the statistical patterns match those assumptions. Predictive analytics go beyond those assumptions to discover previously unknown data; it then looks for patterns and associations anywhere and everywhere between seemingly disparate information.

Let's use the example of a credit card company operating a customer loyalty program to describe the application of predictive analytics. Credit card companies try to retain their existing customers through loyalty programs. The challenge is predicting the loss of customer. In an ideal world, a company can look into the future and take appropriate action before customers switch to competitor companies. In this case, one can build a predictive model employing three predictors: frequency of use, personal financial situations, and lower annual percentage rate (APR) offered by competitors. The combination of these predictors creates a predictive model, which works to find patterns and associations.

This predictive model can be applied to customers who are starting using their cards less frequently. Predictive analytics would classify these less frequent users differently than the regular users. It would then find the pattern of card usage for this group and predict a probable outcome. The predictive model could identify patterns between card usage; changes in one's personal financial situation; and the lower APR offered by competitors. In this situation, the predictive analytics model can help the company to identify who are those unsatisfied customers. As a result, company's can respond in a timely manner to keep those clients loyal by offering them attractive promotional services to sway them away from switching to a competitor. Predictive analytics could also help organizations, such as government agencies, banks, immigration departments, video clubs etc., achieve their business aims by using internal and external data.

On-line books and music stores also take advantage of predictive analytics. Many sites provide additional consumer information based on the type of book one purchased. These additional details are generated by predictive analytics to potentially up-sell customers to other related products and services.

Major Predictive Analytics Vendors

SAS -SAS Enterprise Miner,,SPSS,Insightful-Insightful Miner,StatSoft Inc.-Statistica, Knowledge
Extractions Engines (KXEN)-KXEN Analytic Framework ,Unica-Affinium Model ,Angoss Software
Corporation-Knowledge STUDIO and Knowledge SEEKER ,Fair Isaac Corporation - Model Builder
2.1, IBM - DB2 Intelligent Miner for Data.
How companies use real-time data to plan for the future.

In a tough global economy, sloppy decision making and "going with your gut" can get you punished--swiftly. That's why leading companies are increasingly turning to a new management discipline called predictive analytics to compete and thrive. Rather than relying on intuition when pricing products, maintaining inventory or hiring talent, managers are using data, analysis and systematic reasoning to improve efficiency, reduce risk and increase profits.
In simple terms analytics means using quantitative methods to derive insights from data, and then drawing on those insights to shape business decisions and, ultimately, improve business performance. Thus predictive analytics is emerging as a game-changer. Instead of looking backward to analyze "what happened?" predictive analytics help executives answer "What's next?" and "What should we do about it?"
Research shows that high-performance businesses have a much more developed analytical orientation than other organizations. They are five times more likely than their low-performing competitors to view analytical capabilities as core to the business. Our research shows that there are big rewards for organizations that embrace analytics decision making.

Some of the most famous examples of analytics in action come from the world of professional sports, where "quants" increasingly make the decisions about what players are really worth. Consider these examples from the business world:

--Best Buy ( BBY - news - people ) was able to determine through analysis of member data that 7% of its customers were responsible for 43% of its sales. The company then segmented its customers into several archetypes and redesigned stores and the in-store experience to reflect the buying habits of particular customer groups.--Olive Garden uses data to forecast staffing needs and food preparation requirements down to individual menu items and ingredients. The restaurant chain has been able to manage its staff much more efficiently and has cut food waste significantly.

--TheU.K.'s Royal Shakespeare Co. used analytics to look at its audience members' names, addresses, performances attended and prices paid for tickets over a period of seven years. The theater company then developed a marketing program that increased regular attendees by more than 70% and its membership by 40%. Recent Accenture research highlights the desire of many other companies to become more analytical. In a 2009 survey of 600U.K.andU.S.blue-chip organizations, two-thirds of all respondents cited "getting their data in order" as an immediate priority. Longer-term, the top objective for between two-thirds and three quarters of executives is to develop the ability to model and predict behaviors to the point where individual decisions can be made in real time, based on the analysis at hand To achieve this goal, companies must move fast. Almost 40% of our respondents believe that their current technological resources significantly hinder the effective use of enterprise-wide analytics. But there is no questioning the escalating momentum. Whether it is using analytics to predict customer behavior, set pricing strategy, optimize ad spending or manage risk, analytics is moving to the top of the management agenda.
So what are the next steps? In their new book, Analytics at Work: Smarter Decisions, Better Results, Tom Davenport, Jeanne Harris and Robert Morison describe how organizations can put analytics to work in their organization. If an analytical organization could be established simply by executive fiat, the only remaining challenges would be technical ones.

Predictive Analytics: Beyond the Predictions

We make predictions and act on them all the time. I predict that if I jump into the path of a moving bus, I will be hurt – so I won't jump. I'd conclude that my prediction had been in alignment with my goals, but if I had to, I could only prove it by using the laws of physics or examples of other people's encounters with moving buses.

If done well, predictive analytics help companies avoid business situations analogous to being struck by a bus. Business situations, however, are usually less dramatic and much more nuanced than avoiding a moving vehicle. And, unlike the bus, a company will often not even know there was a situation worth avoiding.
Even so, business peril requires us to try to stay ahead of trouble. Predictive analytics are key to the prevention of loss by fraud, churn and other bad outcomes. Predictive analytics also help prevent the loss of wasted time and money spent on activities that do not contribute to business goals.
But there are limits to the usefulness of predictive analytics as we have applied them to date. One conclusion we have reached is that it is no longer sufficient to simply try to predict an unimpeded future. We must hedge our predictions with probabilities and be aware that a variety of reactions to those probabilities might be in order.

Many predictive models are tuned to report a binomial result, for example, "likely to churn." In practice, multiple actions could occur as a result of this discovery, including "do nothing." Whatever the reaction is (even to an event that has not yet taken place), it must be in alignment with company goals. The predictive models are important unto themselves, but I will focus here on how to support the actions we take when using predictive models, the "next steps" that are often neglected.


Predictive models
Predictive models analyze past performance to assess how likely a customer is to exhibit a specific behavior in the future in order to improve marketing effectiveness. This category also encompasses models that seek out subtle data patterns to answer questions about customer performance, such as fraud detection models. Predictive models often perform calculations during live transactions, for example, to evaluate the risk or opportunity of a given customer or transaction, in order to guide a decision.
Descriptive models
Descriptive models "describe" relationships in data in a way that is often used to classify customers or prospects into groups. Unlike predictive models that focus on predicting a single customer behavior (such as credit risk), descriptive models identify many different relationships between customers or products. But the descriptive models do not rank-order customers by their likelihood of taking a particular action the way predictive models do. Descriptive models are often used "offline," for example, to categorize customers by their product preferences and life stage.
Decision models
Decision models describe the relationship between all the elements of a decision — the known data
(including results of predictive models), the decision and the forecast results of the decision — in order to predict the results of decisions involving many variables. These models can be used in optimization, a data driven approach to improving decision logic that involves maximizing certain outcomes while minimizing others. Decision models are generally used offline, to develop decision logic or a set of business rules that will produce the desired action for every customer or circumstance.
Conclusion
Predictive analytics adds great value to a businesses decision making capabilities by allowing it to formulate smart policies on the basis of predictions of future outcomes. A broad range of tools and techniques are available for this type of analysis and their selection is determined by the analytical maturity of the firm as well as the specific requirements of the problem being solved.

SAS TIPS

SAS TIPS



   A semicolon is your friend, 
       That's how all SAS Program ends,
   If you have lots of error,
      Search for missing semicolon, which can end your terror.. :))




   1.       Do you know: You can prevent the SAS Datasets from Accidently being replaced…!!!
Users can specify the NOREPLACE system option to prevent a permanent SAS data set from being accidentally replaced with another like-named data set.
   
   2.       If you have a Note: “CHARACTER STRING WAS MORE THAN 200 CHARACTERS” in Log there are fair chances that you program have unbalanced Quotation Marks.
   3.       Do you know that you can capture the ONLY SAS Windows Screen shot using ALT + PRTSC.
  4.        Do you know for sorting SAS Dataset, it requires 4 times space of your data for processing?
   5.       Before submitting the final SAS Program that use a large data, Use OBS= option to test on subset of data to make sure your program syntax is correct.
   6.       Do you know how many factors affect the performance of your program?
   7.       Do you have problem in remembering Syntax?
  Ease your efforts with use of Abbreviation. It can also reduce the typing efforts?
  Goto : Tools  à Add Abbreviation
   8.        Do you know COUNT function can give you count of number of occurrence of substring within a string?
COUNT (string, substring, optional modifiers)
   9.       Do you know  option compress= char or compress=yes is good for compressing the data with large character values




Predictive Analytics = Predictive Modeling + Forecasting

Predictive Analytics = Predictive Modeling + Forecasting...

At the time of learning SAS, I was always wondered what is the difference between two most demanding terms “Predictive modelling” and “Forecasting”. I got good article from “SAS Knowledge Exchange”, Which helped me to get better understanding of both terms and more detail about Predictive modelling.

When everyone is talking about the Big Data, how to meet customer expectation which is on rise day by day, and most important competition , all companies are moving from “old way of reporting” which used to give the idea about ”what happened?”  To the more precise solution that provide idea about present and also predict the future foresight.

And so Predictive Modelling is ideal and best approach that organizations can use to win the customers and competition. This process of predictive modelling involves detail understanding of: What has happened? What is happening? And what is likely to happen in future. 

Getting insight about the behaviors, requirement, liking and outlook of customers can help organization to make informed decisions and get benefit in increasing the positive outcome of their strategies or build new strategies.
Predictive Modelling is used to predict the sales and marketing customers’ behaviours, fraudulent insurance claims, military supply chain problem, customer attrition or spread of pandemic disease.
“Predictive analytics” is combination of predictive modeling and forecasting. Predictive modeling aims to address the who, when, and why questions for business issues, such as those related to customer behaviour, product usage, and likelihood to purchase.
Predictive Modeling can help us to get answer of:
·         Which of my current consumers will go to the competition?
·         Why will my current customers leave?
·         When will my customers leave?

Forecasting responses to questions such as:
·         How many customers will you lose in the next 6 months to competition?
·         How many people will be affected with a certain pandemic disease in the next 12 months in a given country?

·         What are the expected liabilities from incurred, but not reported, insurance claims?

Main advantage of predictive analytics includes effective and lucrative campaigns with messages and suggestions that are relevant to the target customer. Companies can improve response rate by recognising customers that are most likely to respond to a deal or most likely to leave for a competitor, increase acquisition rate, reduce marketing campaigns costs and even save some lives.

Friday 23 December 2016

SAS Libraries



SAS Libraries 


1) Every SAS file is stored in a SAS library.

2) SAS Library is a collection of SAS files.

3) A SAS data library is the highest level of organization for information within SAS.

4) In the Windows and UNIX environments, a library is typically a group of SAS files in the same folder or directory.



Temporary Library:
 Its Temporary Storage Location of a data file
 They last only for the current SAS session
 Work is the temporary library in SAS
 When the session ends, the data files in the
temporary library are deleted
 The file is stored in Work, when:

 No specific library name is used while

creating a file

 Specify the library name as Work

Permanent Library:
 It’s the Permanent storage location of data files
 Permanent SAS libraries are available in
subsequent SAS sessions
 Permanent SAS data libraries are stored until delete
them
 To store files permanently in a SAS data library:
 Specify a library name Other than the
default library name Work
 Three Permanent Libraries provided by SAS are:
 Local
 SASuser
 SAShelp
 
 
Creating a Permanent Library:
 To create a permanent library use libname statement
 It creates a reference to the path where SAS files are stored
 The LIBNAME statement is global, which means that the librefs remain in effect until modify
them , cancel them, or end your SAS session
 The LIBNAME statement assigns the libref for the current SAS session only
 Assign a libref to each permanent SAS data library each time a SAS session starts
 SAS no longer has access to the files in the library, once the libref is deleted or SAS session is
ended.
 Contents of Permanent library exists in the path specified
Syntax :
libname <libref> ‘<path>‘ ;
where,
 libref is the name of the library to be created
 It can be 1 to 8 characters long
 Begins with a letter or underscore
 Contains only letters, numbers, or underscores
 path is location in memory to store the SAS files
 
 Example:
libname Taxes ‘C:\Documents and Settings\admin\Desktop\Training‘ ;
Here,
 Taxes - A library reference name
 libname - This keyword assigns the libref taxes to the folder called
training in the path:
‘C:\Documents and Settings\admin\Desktop\Training‘
 Path should be specified in single code
Data lib1.emp;
Length name$ 12;
Input id name$ doj sal;
Informat doj mmddyy8. sal dollar7.;
Format doj date9. sal dollar7.;
Label id = “Employee Id” name = “Employee Name” doj = “Date of Joining”
Sal = “Salary”;
Cards;
1076 abcasdayut 12/23/05 $10,000
1983 aaaertgr 07/12/98 $40,000
1723 xyzasdsf 04/15/98 $25,000
;
Run;

Proc Content

Proc Content


Data Understanding


Proc Contents Step:

The CONTENTS procedure is used to create SAS output that describes either of the following:

  • The contents of a library
  • The descriptor information for an individual SAS data set

Describes the structure of the data set rather than the data values
Displays valuable information at the...
              Data set level

  • Name
  • Engine
  • Creation date
  • Number of observations
  • Number of variables
  • File size (bytes)
            Variable level
  • Name
  • Type
  • Length
  • Formats
  • Position
  • Label
Syntax:

Proc Contents Data = libref . _ALL_ NODETAILS;
Run;

Where,
  • libref is the libref that has been assigned to the SAS library.
  • _ALL_ requests a listing of all files in the library
  • A period (.) is used to append _ALL_ to the libref
  • NODETAILS (NODS) suppresses the printing of detailed information about each file
  • when _ALL_ is specified.
  • Specify NODS only when you specify _ALL_
Example:

To view the contents of the Mylib library, submit the following PROC CONTENTS step:

proc contents data = mylib ._all_ nods ;
run ;

The output from this step lists only the names, types, sizes, and modification dates for the SAS
 files in the Mylib library
 
To view the descriptor information for the Mylib.Admit data set, submit the following PROC
CONTENTS step:

proc contents data = mylib .admit ;
run ;

The output from this step lists information for Mylib.Admit data set, including an alphabetic list of
 the variables in the data set