Data step array: flexible (conditional execution) and code-efficient; loop-oriented and have to be familiar with OUTPUT operator. .
Proc Transpose: intuitive and simple; very limited options and no condition can be set
`********************HOW TO GENERATE A MULTIPLICATION TABLE*******************;**********OPTION1: COMBINED METHOD (DATA STEP SIMULATION -- PROC TRANSPOSE -- DATA STEP ARRAY)**********;**********STEP1: DATA STEP SIMULATION;data one;    do i=1 to 9;        do j=1 to 9;          v=i*j;          output;        end;    end;run;   **********STEP2: PROC TRANSPOSE;proc transpose data=one out=two(drop=_name_);    var v;    by i notsorted;      *Since i is ordered, no sorting is needed with command 'notsorted';run;**********STEP3: DATA STEP ARRAY;data three; set two; array a[9] col1-col9; do p = 1 to 9;  if _n_ lt p then  a[p] = .;    end; drop i p;run;**********END OF OPTION 1**********;**********OPTION2: SINGLE STEP**********;data four; array a[9] col1-col9;    do i = 1 to 9;           *Generate outer layer loop;   do j= 1 to 9;      *Generate inner layer loop;    if i ge j then a[j]=i*j;   *Horizontally pass values to the nine columns as long as the condition is satisfied;   end;  output;         *Each loop one row is outputed; end; drop i j;run;**********END OF OPTION 2**********;********************END OF SAS CODE*******************;`

`/*SET UP A RESULT DATASET*/data result;     do id = 'a', 'b', 'c' ;        output;    end;run;/*SPECIFIC INTERVALS ARE ASSIGNED*/%macro summary2(time1, time2, time3, time4);    %do i=1 %to 4;        proc sql;            create table result as            select a.*, b.first&&time&i            from result as a, (                                    select id, sum(sale) as first&&time&i                                    from test                                    where day le &&time&i                                    group by id                                    ) as b            where a.id = b.id            ;        quit;    %end;%mend;/*USE A SIMULATION DATASET TO TEST*/data test;     do id='a', 'b', 'c';        do day=1 to 100;           sale=ranuni(9796876)*100;           output;        end;     end;run;/*INPUT THE INTERVALS AND HAVE THE RESULTS*/%summary2(5, 12, 37, 89); `

I'm making a leap of faith that one of the resources I provide in this post answers the question from a recent feedback form submission. If you have other interpretations or resources, please add them to the comments. Let's help each other out.

Q: I'm trying to find the Excel Add-In
A: I'm not sure if you need to locate it and install it, or if you are looking for information to help you use it. Both are addressed below.

My #1 suggestion when you are truly stumped:
Leverage the user community and post your questions to the Integration with Microsoft Office discussion forum.

If you are looking for usage information and tips or debugging information, try these links on support.sas.com:

If you are looking for a download of the add-in, that is not available from our software downloads site. The option is to contact the SAS Installation Contact at your company or contact SAS Technical Support.

SAS 造成許多初學者學習障礙的主要原因是因為語法很多，對於沒有程式撰寫基礎的人來說，門檻可說是相當的高。坊間有許多不同的 SAS 參考書，但內容程度不一，不過有個共同的特點就是，頁數都很多，內容也很雜。通常參考書一開始會從資料格式與輸入開始教，再來是敘述統計量的輸出方法，還有一些簡單的 Proc 程序，然後是作圖，最後通常會用一些函式和 macro 的介紹。印象中自己也買過兩本中文的 SAS 參考書，但必須承認的一件事是：我從來沒有從頭到尾看完過一遍，通常都是要用到某些語法時才去翻。即便自己對 SAS 已屬稍微熟悉，但仍舊沒有辦法記住所有語法，每隔一段時間，某些語法就會從腦海裡面消失，等到要用的時候再去翻書。後來網路發達了，可以用孤狗去搜尋語法，看似比翻書快了一些，但網路搜尋的結果有時候一開始並不是自己真正想要去尋找的目標，也許需要翻個幾頁，開過幾個連結看一下才能找到真正想要的內容。這種情況所消耗的時間可能跟翻書是差不多的。此外，即便是已經熟悉語法了，但可能因為分析內容的需要，必須大量重複使用一些相當簡單比方說 Proc sort 或 Proc print 等程序。Macro 雖然提供了簡化程式行數的功能，但像 Proc sort 或 Proc print 程序本來就不需要花什麼行數，先宣告 macro 並沒有特別節省掉多少程式碼。如果有一種功能，就是當寫程式寫到一半，知道某個語法但忘記裡面要放什麼參數，SAS 能適時給予提醒，或者是利用更簡短的自訂名稱來取代頻繁使用的簡單程序，便可以讓程式撰寫的過程更省時省力。這種功能在 SAS 裡面，叫做「SAS abbreviation」。

CONTACT INFORMATION
Elizabeth Ceranowski
Student Programs Manager
SAS Institute Inc.
SAS Campus Drive
Cary, NC 27513
Work Phone:  (919) 531-9347
E-mail: Elizabeth.Ceranowski@sas.com

SAS 造成許多初學者學習障礙的主要原因是因為語法很多，對於沒有程式撰寫基礎的人來說，門檻可說是相當的高。坊間有許多不同的 SAS 參考書，但內容程度不一，不過有個共同的特點就是，頁數都很多，內容也很雜。通常參考書一開始會從資料格式與輸入開始教，再來是敘述統計量的輸出方法，還有一些簡單的 Proc 程序，然後是作圖，最後通常會用一些函式和 macro 的介紹。印象中自己也買過兩本中文的 SAS 參考書，但必須承認的一件事是：我從來沒有從頭到尾看完過一遍，通常都是要用到某些語法時才去翻。即便自己對 SAS 已屬稍微熟悉，但仍舊沒有辦法記住所有語法，每隔一段時間，某些語法就會從腦海裡面消失，等到要用的時候再去翻書。後來網路發達了，可以用孤狗去搜尋語法，看似比翻書快了一些，但網路搜尋的結果有時候一開始並不是自己真正想要去尋找的目標，也許需要翻個幾頁，開過幾個連結看一下才能找到真正想要的內容。這種情況所消耗的時間可能跟翻書是差不多的。此外，即便是已經熟悉語法了，但可能因為分析內容的需要，必須大量重複使用一些相當簡單比方說 Proc sort 或 Proc print 等程序。Macro 雖然提供了簡化程式行數的功能，但像 Proc sort 或 Proc print 程序本來就不需要花什麼行數，先宣告 macro 並沒有特別節省掉多少程式碼。如果有一種功能，就是當寫程式寫到一半，知道某個語法但忘記裡面要放什麼參數，SAS 能適時給予提醒，或者是利用更簡短的自訂名稱來取代頻繁使用的簡單程序，便可以讓程式撰寫的過程更省時省力。這種功能在 SAS 裡面，叫做「SAS abbreviation」。

CONTACT INFORMATION
Elizabeth Ceranowski
Student Programs Manager
SAS Institute Inc.
SAS Campus Drive
Cary, NC 27513
Work Phone:  (919) 531-9347
E-mail: Elizabeth.Ceranowski@sas.com

Seth Grimes posted a fantastic article on Text Data Quality yesterday. A must read for anyone in this space. The article points to some of the text quality issues I have mentioned in my last two blogs. Text is in a league of its own when it comes to data quality. And the more you have to work with social media generated data, the more you will run into non-standard text and the need for text cleansing. I presented a workshop where I talked about "The Ten Transgressions of Text" at the Text Analytics Summit in June:

1. UPPERCASE/lowercase
2. Miss-spelings
3. A.C.R.O.N.Y.M.S
4. Shrt-hnd or clipped text (e.g. hmm tink nid >2 twitter acs; els msgs all jumbled up btwn personal & thots! dilemma!)
5. Pr☺f@nity
6. !!NOISY TEXT!!
7. /*Punctuation*\
8. ♪ Voice ♫
9. Email / Attachments
10. Poor grammar

Customers ask me if we can automatically remove profanity from documents and, yes, WE CAN!

My interest in the sorts of shortened/clipped texts that you get in text messages or via Twitter is huge. There is a lot text analytics users and vendors can do to work with this data. Terms like "cul8r" (see you later), or "LOL" (laughing out loud / lots of love) could be expanded into their intended forms, mapped to other synonyms(we provide ontologies to handle this), or left as is. When a shortened term can mean several different things depending on context, that's when the linguistics can help. I see a big need for including this new 'language' into standard language dictionaries.

Adhering to the standard rules of grammar looks like a thing of the past. As traditional print media loses favor, so will standard grammar in social media (blogs, micro-blogs such as FaceBook, Twitter, Bebo etc.). I'm excited to see how other natural language processing technologies will change to accommodate the new breed of user.

#################################################
# A STANDARD VECTOR AUTOREGRESSIVE (VAR) MODEL  #
# TO FORECAST 3-MONTH TBILLS, 10-YEAR TBONDS,   #
# AND STOCK-WATSON EXPERIMENTAL RECESSION INDEX #
#################################################

library(vars)
library(fEcofin)

# CONVERT DATA FRAME INTO TS OBJECT
data(recession)
ts <- ts(recession[, 3:5], start = c(1966, 1), frequency = 12)

# PLOT SERIES
plot(ts, main = "US Recession Data")

# SELECT THE BEST LAG
select <- VARselect(ts, lag.max = 12, type = "both")
# \$selection
# AIC(n)  HQ(n)  SC(n) FPE(n)
#    10      3      2     10

# ESTIMATE VAR MODEL
var <- VAR(ts, p = 2, type = "both")
# Estimated coefficients for equation tbills3m:
# =============================================
# tbills3m = tbills3m.l1 + tbonds10y.l1 + xri.l1 + tbills3m.l2 + tbonds10y.l2 + xri.l2 + const + trend
#  tbills3m.l1  tbonds10y.l1        xri.l1   tbills3m.l2  tbonds10y.l2
# 1.1212021873  0.3505955923  1.2871875302 -0.1731594979 -0.3124729186
#       xri.l2         const         trend
# -1.4660556670  0.1313513828 -0.0003302518

# Estimated coefficients for equation tbonds10y:
# ==============================================
# tbonds10y = tbills3m.l1 + tbonds10y.l1 + xri.l1 + tbills3m.l2 + tbonds10y.l2 + xri.l2 + const + trend
#
#  tbills3m.l1  tbonds10y.l1        xri.l1   tbills3m.l2  tbonds10y.l2
# -0.0562701733  1.3349464685  0.3114932693  0.0766959847 -0.3645448725
#       xri.l2         const         trend
# -0.3768012352  0.1387545242 -0.0001249355

# Estimated coefficients for equation xri:
# ========================================
# xri = tbills3m.l1 + tbonds10y.l1 + xri.l1 + tbills3m.l2 + tbonds10y.l2 + xri.l2 + const + trend
#  tbills3m.l1  tbonds10y.l1        xri.l1   tbills3m.l2  tbonds10y.l2
# 1.421629e-02 -9.035927e-04  1.078047e+00  7.673239e-03 -1.496342e-02
#       xri.l2         const         trend
# -2.589415e-01  2.379950e-02 -3.815981e-05

plot(var)

*** SIMULATE DATA WITH OUTLIERS ***;
data one;
do i = 1 to 1000;
x1 = ranuni(1);
x2 = ranuni(2);
if i > 900 then y = 50 + rannor(1);
else y = 10 + 2 * x1 + 4 * x2 + rannor(1) * 0.5;
output;
end;
run;

*** ROBUST REGRESSION WITH M-ESTIMATION ***;
proc robustreg data = one method = m;
model y = x1 x2;
run;
/*
Standard   95% Confidence     Chi-
Parameter DF Estimate    Error       Limits       Square Pr > ChiSq
Intercept  1   9.8867   0.0463   9.7959   9.9776 45506.8     <.0001
x1         1   2.1440   0.0591   2.0282   2.2597 1318.17     <.0001
x2         1   4.0620   0.0606   3.9433   4.1806 4500.31     <.0001
Scale      1   0.5850
*/

*** GENERALIZED MAXIMUM ENTROPY ***;
proc entropy data = one gmenm;
model y = x1 x2;
run;
/*
Approx                  Approx
Variable        Estimate     Std Err    t Value     Pr > |t|
x1               0.30864     0.00877      35.20       <.0001
x2              1.490858      0.0397      37.58       <.0001
Intercept       15.02985      0.3087      48.69       <.0001
*/

*** RIDGE REGRESSION ***;
proc reg data = one ridge = 1 to 4 by 0.1 outest = est;
model y = x1 x2 / noprint;
run;

proc print data = est;
run;
/*
_MODEL_  _TYPE_  _DEPVAR_  _RIDGE_  _PCOMIT_   _RMSE_  Intercept     x1       x2     y
MODEL1   PARMS      y         .         .     11.0916   14.3101   0.60107  4.17812  -1
MODEL1   RIDGE      y        1.0        .     11.1080   15.5109   0.28663  2.08686  -1
MODEL1   RIDGE      y        1.1        .     11.1096   15.5677   0.27235  1.98739  -1
MODEL1   RIDGE      y        1.2        .     11.1111   15.6192   0.25943  1.89697  -1
MODEL1   RIDGE      y        1.3        .     11.1125   15.6663   0.24767  1.81442  -1
MODEL1   RIDGE      y        1.4        .     11.1139   15.7094   0.23693  1.73876  -1
MODEL1   RIDGE      y        1.5        .     11.1152   15.7491   0.22708  1.66915  -1
MODEL1   RIDGE      y        1.6        .     11.1164   15.7856   0.21802  1.60491  -1
MODEL1   RIDGE      y        1.7        .     11.1176   15.8195   0.20965  1.54542  -1
MODEL1   RIDGE      y        1.8        .     11.1187   15.8509   0.20190  1.49019  -1
... ...
*/
Tagged with:

If you want to save money when you register for SAS Global Forum 2010, check out the two new package offers. Both offers bundle popular registration options at a discount. Not only will they save you money, these special packages may also help you with getting conference approval. It’s an easy way to demonstrate to your boss that you’re containing costs and receiving the most value out of the money you spend.

Package 2 includes a business and government conference registration, Sunday opening night dinner, Monday lunch, and Tuesday lunch & speaker. Translation: Registration and all meal options rolled into one value price.

Package 3 includes a business & government registration, Sunday opening night dinner, Monday lunch, Tuesday lunch & speaker, and a Sunday or Wednesday seminar of your choice. Translation: Same benefits as Package 2 plus an added educational seminar of your choice - even more value.

But the good news doesn’t stop there. A record number of papers were submitted to SAS Global Forum this year – an increase of over 11% from last year! I see this as evidence that enthusiasm for SGF continues to grow. Even after 35 years, SAS Global Forum is still the largest and most exciting gathering of SAS professionals worldwide. Don’t miss out on the premier event for SAS professionals. Register now!

We launched another forum on Friday afternoon! The Web Report Studio forum was created to establish a community of users that can share information, questions, and ideas about SAS Web Report Studio. While watching the discussions in our existing forums, I noticed that Web Report Studio questions were being asked in many of our forums. When the Web Report Studio forum launched, I searched for some of the more active posts and moved them to the new forum. If you haven't visited it yet, take a look. The forum already contains some nice discussions.

If you are a Web Report Studio user, you may also be interested in some of these resources:

As always, we hope that you will use this forum to share experiences, post questions and suggestions, offer solutions, and interact with other SAS customers. Remember that you can follow the conversation in e-mail by setting a watch or in an RSS feed by subscribing to items that interest you. Instructions for both of these tasks are provided in Watching a forum.