Sunteți pe pagina 1din 5

* Introduction to SAS

* SAS Libraries/* Canonical read in readin infile input text CSV file: */

data Val500_Fielder_DIVI_Granulation;
infile F DLM=',' DSD MISSOVER LRECL=2600 FIRSTOBS=3;
input Product :$40. mydt :DATE. ... ;
run;

/* Count spaces in a macrovariable by compressing them away */


%let l1=%length(&spacey);
%let c=%sysfunc(compress(&spacey));
%let l2=%length(&c);
%let csp=%eval(&l1-&l2);

* Creating temporary/permanent SAS datasets


* Reading raw data from external files
* issing value '.' always sort lower than char or num and ._ sorts lowest of all
SAS Special Missing Value (.A thru .Z)
...else if comment = 'refused to answer' then age = .A;...

/* Write all variables to the Log with "foo=" notation on one line: */
put _ALL_ /* print PDV to Log */
put 'WARNING: ' _ALL_
/* Write all variables to the Log with "foo=" notation on one line per var: */
put (_ALL_)(=)
Proc Import
* Reading data from an Excel spreadsheet
* Creating and Redefining Variables
* Informats, formats and labels
* Creating and Applying User-Defined formats
* Conditional processing
* Subsetting and combining SAS datasets
* Modifying SAS datasets
* SAS Data S Introduction to SAS
* SAS Libraries/* Canonical read in readin infile input text CSV file: */

data Val500_Fielder_DIVI_Granulation;
infile F DLM=',' DSD MISSOVER LRECL=2600 FIRSTOBS=3;
input Product :$40. mydt :DATE. ... ;
run;

/* Count spaces in a macrovariable by compressing them away */


%let l1=%length(&spacey);
%let c=%sysfunc(compress(&spacey));
%let l2=%length(&c);
%let csp=%eval(&l1-

/* Count spaces in a macrovariable by compressing them away */


%let l1=%length(&spacey);
%let c=%sysfunc(compress(&spacey)); -- Postgres WITH temporary table creation
with val as ( -- Postgres age today and at end of year e.g. 51 years 8 mons 4 days
| 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;
ALTER TABLE Customer DROP COLUMN Birth_Date;
ALTER TABLE analytics.build ADD COLUMN rundatacheck boolean NOT NULL DEFAULT TRUE;
ALTER TABLE analytics.archivebuildconfig ADD COLUMN job_type text NOT NULL DEFAULT
'Imports';
%let l2=%length(&c); .Z)
...else if comment = '-- Postgres WITH temporary table creation
with val as ( values ('1427315266'),('1003048109'),('1003109422'),('1003128414') )
select column1 from val;-- Postgres age today and at end of year e.g. 51 years 8
mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatacheck boolean NOT NULL DEFAULT TRUE;
ALTER TABLE analytics.archivebuildconfig ADD COLUMN job_type text NOT NULL DEFAULT
'Imports';
%let l2=%length(&c); .Z)
...else if comment = '-- Postgres WITH temporary table creation
with val as ( values ('1427315266'),('1003048109'),('1003109422'),('1003128414') )
select column1 from val;

-- Postgres age today and at end of year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatachec

-- Postgres age today and at end of year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatachecPostgres age today and at end of
year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;
ALTER TABLE Customer DROP COLUMN Birth_Date;
ALTER TABLE analytics.build ADD COLUMN rundatacheck boolean NOT NULL DEFAULT TRUE;
ALTER TABLE analytics.archivebuildconfig ADD COLUMN job_type text NOT NULL DEFAULT
'Imports';
%let l2=%length(&c); .Z)
...else if comment = '-- Postgres WITH temporary table creation
with val as ( values ('1427315266'),('1003048109'),('1003109422'),('1003128414') )
select column1 from val;

-- Postgres age today and at end of year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatachecalues ('1427315266'),
('1003048109'),('1003109422'),('1003128414') )
select column1 from val;

-- Postgres age today and at end of year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatacheck boolean NOT NULL DEFAULT TRUE;
ALTER TABLE analytics.archivebuildconfig ADD COLUMN job_type text NOT NULL DEFAULT
'Imports';
%let l2=%length(&c); .Z)
...else if comment = '-- Postgres WITH temporary table creation
with val as ( values ('1427315266'),('1003048109'),('1003109422'),('1003128414') )
select column1 from val;

-- Postgres age today and at end of year e.g. 51 years 8 mons 4 days | 52:
select age('1965-10-30'::date), date_part('year', age('2017-12-31', '1965-10-30'))

' Weighted average in Excel (patient count in C, lift % in col F):


=SUMPRODUCT(F7:F23,C7:C23)/SUM(C7:C23)

-- Postgres first day of year beginning of year


SELECT date_trunc('year', now())::date;

ALTER TABLE Customer DROP COLUMN Birth_Date;


ALTER TABLE analytics.build ADD COLUMN rundatacheck boolean NOT NULL DEFAULT TRUE;
ALTER TABLE analytics.archivebuildconfig ADD COLUMN job_type text NOT NULL DEFAULT
'Imports';refused to answer' then age = .A;...

/* Write all variables to the Log with "foo=" notation on one line: */
put _ALL_ /* print PDV to Log */
put 'WARNING: ' _ALL_
/* Write all variables to the Log with "foo=" notation on one line per var: */
put (_ALL_)(=)
Proc Import
%let csp=%eval(&l1-&l2);

* Creating temporary/permanent SAS datasets


* Reading raw data from external files
* issing value '.' always sort lower than char or num and ._ sorts lowest of all
SAS Special Missing Value (.A thru .Z)
...else if comment = 'refused to answer' then age = .A;...

/* Write all variables to the Log with "foo=" notation on one line: */
put _ALL_ /* print PDV to Log */
put 'WARNING: ' _ALL_
/* Write all variables to the Log with "foo=" notation on one line per var: */
put (_ALL_)(=)
Proc Import
* Reading data from an Excel spreadsheet
* Creating and Redefining Variables
* Informats, formats and labels
* Creating and Applying User-Defined formats
* Conditional processing
* Subsetting and combining SAS datasets
* Modifying SAS datasetset Options
* Working with dates
* SAS Date, Time, and Datetime values
* numeric functions
* character functions
* Global statements (titles, footnotes, system options)
* By group processing
* Customizing Titles and Footnotes
* Arrays
* Exporting SAS Data
* Creating TXT/RTF/PDF Ou

* Creating temporary/permanent SAS datasets


* Reading raw data from external files
* issing value '.' always sort lower than char or num and ._ sorts lowest of all
SAS Special Missing Value (.A thru .Z)
...else if comment = 'refused to answer' then age = .A;...

/* Write all variables to the Log with "foo=" notation on one line: */
put _ALL_ /* print PDV to Log */
put 'WARNING: ' _ALL_
/* Write all variables to the Log with "foo=" notation on one line per var: */
put (_ALL_)(=)
Proc Import
* Reading data from an Excel spreadsheet
* Creating and Redefining Variables
* Informats, formats and labels
* Creating and Applying User-Defined formats
* Conditional processing
* Subsetting and combining SAS datasets
* Modifying SAS datasetset Options
* Working with dates
* SAS Date, Time, and Datetime values
* numeric functions
* character functions
* Global statements (titles, footnotes, system options)
* By group processing
* Customizing Titles and Footnotes
* Arrays
* Exporting SAS Data
* Creating TXT/RTF/PDF Output
* Proc Print
* Proc Contents
* PROC SORT
* Proc Datasets
* PROC Means
* PROC Freq
* PROC Report
* PROC Tabulate
* PROC UNIVARIATE
* Generating charts
* Proc SQL
* Introduction to SAS Macro Language /Saving and storing macros
* SAS logs
* Debugging SAS Programs

S-ar putea să vă placă și