超经典的SAS BASE的笔记6Word文档下载推荐.docx

上传人:b****3 文档编号:17824185 上传时间:2022-12-11 格式:DOCX 页数:25 大小:26.32KB
下载 相关 举报
超经典的SAS BASE的笔记6Word文档下载推荐.docx_第1页
第1页 / 共25页
超经典的SAS BASE的笔记6Word文档下载推荐.docx_第2页
第2页 / 共25页
超经典的SAS BASE的笔记6Word文档下载推荐.docx_第3页
第3页 / 共25页
超经典的SAS BASE的笔记6Word文档下载推荐.docx_第4页
第4页 / 共25页
超经典的SAS BASE的笔记6Word文档下载推荐.docx_第5页
第5页 / 共25页
点击查看更多>>
下载资源
资源描述

超经典的SAS BASE的笔记6Word文档下载推荐.docx

《超经典的SAS BASE的笔记6Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《超经典的SAS BASE的笔记6Word文档下载推荐.docx(25页珍藏版)》请在冰豆网上搜索。

超经典的SAS BASE的笔记6Word文档下载推荐.docx

oDouble-doublespacestheprintedoutput.

oLabel-usesvariablelabelsascolumnheadings(variablenameisdefaultheading).

oNoobs-suppressestheobservationnumberintheoutput.

Example1Listcontainingallthevariablesandalltheobservations.

dataa;

inputyearsalescost;

profit=sales-cost;

cards;

19811213211021

19821982312928

19831698214002

19841843214590

;

run;

procprintdata=a;

title'

SimplePROCPRINTReport'

Example2RemovalofcolumnOBSandimpressionlimitedtothefirst5observations.

dataexprev;

inputRegion$State$Monthmonyy5.

ExpensesRevenues;

formatmonthmonyy5.;

datalines;

SouthernGAJAN9520008000

SouthernGAFEB9512006000

SouthernFLFEB95850011000

NorthernNYFEB9530004000

NorthernNYMAR9560005000

SouthernFLMAR95980013500

NorthernMAMAR9515001000

procprintdata=exprev(obs=5)noobs;

varmonthstateexpenses;

MonthlyExpensesforOfficesinEachState'

Example3InstructionIDwithnotsortedobservations

databid;

inputidage;

98765

68775

25455

23670

procprint;

Example4InstructionID,aftersortingoftheobservations.

databid2;

inputpat_idage;

procsort;

bypat_id;

*varpat_id;

idpat_id;

Example5Testofoneortheothercondition,instructionWHERE

databid3;

procprintnoobs;

varage;

whereage<

75;

Example6InstructionSUM.

datatrim;

inputvendor$moisquantiteCOMMA5.tot_vendorcomma11.2;

datalines;

Hollingsworth0453010,573.50

Hollingsworth051,12022,344.00

Hollingsworth051,03020,548.50

Jones041,11022,144.50

Jones0467513,466.25

Smith041,71534,214.25

Smith0651210,214.40

Smith061,00019,950.00

PROCPRINTDATA=trimNOOBS;

TITLE'

Totalofvariablesnames'

VARvendormoisquantitetot_vendor;

WHEREquantite>

500ORtot_vendor>

20000;

SUMquantitetot_vendor;

RUN;

Example7InstructionsSUMandBYstatement

datatrim2;

procsort;

byvendor;

PROCPRINTDATA=trim2NOOBS;

SummarybyVender'

Example8InstructionPAGEBYandSUMBY

datatrim3;

PROCPRINTDATA=trim3NOOBS;

SUMBYvendor;

PAGEBYvendor;

Pagebyoptioncontrolspageejectsthatoccurbeforeapageisfull.

Sumbyoptionlimitsthenumberofsumsthatappearinthereport.

Example9OptionswithLabel,Double,TitleandFootnote

PROCPRINTDATA=trim5NOOBSlabeldouble;

SummarybyVendor'

FOOTNOTE'

ResultsofData-trim4'

LABELvendor='

Vendor'

mois='

Mois'

quantite='

QuantityofVendor'

tot_vendor='

TotalofVendors'

TheFREQprocedureproducesone-,two-,…n-way(crosstabulation)frequencytables.

TheSASprocedurePROCFREQiscommonlyusedtoproducesummarydataintabularform.Itcanbeusedoneithercharacterornumericdata.Statisticalanalysiswillbefollowedlater.Sevenexamplesareshownhereusingthisprocedureonfreq_xdataset.ThefollowingisasummaryofoptionsandoptionalstatementsthatcanbeusedwithPROCFREQ.Optionalstatementscanbeinanyorder,whileoptionsareenteredattheendoftheTABLESstatement,following"

/"

andbefore"

"

NotethatthislistrepresentsonlyaportionofallavailabletotheuserfromSAS:

∙TABLES-optionalstatementforspecifyingthevariablestobeincludedintheanalysis.

∙WEIGHT-optionalstatementforspecifyingthevariablestobesummedforeachvalueofthevariablesspecifiedintheTABLESstatement.

∙MISSING-optiontoincludemissingvaluesinthecalculationswithinthetable.

∙MISSPRINT-optiontodisplaythemissingvaluesinthetableswithoutincludingtheminthecalculations.

∙LIST-optiontolistvaluesofvariablessidebysideratherthanintabularform.

∙OUT=-optiontocreateadatasetcontainingtheoutputgeneratedbytheTABLESstatement.

Therearesomeofoptions,Nofreq,Norow,Nocol,Nopercentetal.

Syntax:

PROCFREQoptions;

BYvariables;

TABLESrequests<

/options>

WEIGHTvariable;

Example1:

simpleoutput

datafreq_01;

inputname$sex$ageheight;

AllanM25174

BenM23176

ChristineF24164

DavidM32174

EdwardsM36178

Frank.38172

GloryF28166

HillM32170

JackM33172

Katy.26162

LilyF24169

PaulaF.163

procfreqdata=freq_01;

title1'

PROCFREQ:

example01'

title2'

Nokeywordsspecified'

Example2:

One-waytable

procfreqdata=freq_02;

tablessexage;

1-waytablesforsexandagespecifiedbyTABLESkeyword'

Example3:

2-waytables

procfreqdata=freq_03;

tablessex*age;

two-waytablesforsexandagespecifiedbyTABLESkeyword'

Example4:

2-waytableslistingofthevaluesofthevariablessidebyside

procfreqdata=freq_04;

tablessex*age/listmissing;

two-waytablesusinglistandmissing'

Example5:

3waytables

procfreqdata=freq_05;

tablesname*sex*age;

3waytable:

heightbyweight,controllingforname'

/*Thefirstvariablerepresentsthecontrolvariable*/;

Example6:

Weightdata

DATAfreq_06;

INPUTrater1rater2count;

DATALINES;

115

122

131

211

227

232

311

322

339

PROCFREQDATA=freq_06;

WEIGHTcount;

TABLErater1*rater2;

TITLE1'

weighteddata'

Example7:

Outoption

tablesage/out=freq_07;

createnewdatasetusingoutoption'

Example8:

Missing/Missprint

tablessex/missing;

/*misprint*/

Example9:

NLEVELS

inputagegrpsex$@@;

1F1F1M2M2M3F3F3F

procfreqdata=anlevels;

tablessex*agegrp/noprint;

ThisoptioninPROCFREQstatementisusedtodisplaythe“NumberofVariableLevels”.ByusingthisoptionswecangetthedistinctcountforeachvariablelistedintheTABLESstatement.ItisbesttouseNLEVELSandNNOPRINToptionsoptiontoknowthenumberoflevelsofvariablebeforeprintingthefrequencytableifthedatasetistoolargeinsizeandifyouunawareofwhatcouldbedistinctcountforeachvariable.

Example10:

CROSSLIST

displayscrosstabulationtablesinODScolumnformat.ThisoptioncreatesatablethathasatabledefinitionthatyoucancustomizebyusingtheTEMPLATEprocedure.

tablessex*agegrp/crosslist;

Warning:

youcannotspecifyboththeLISToptionandtheCROSSLISToptioninthesameTABLESstatement.

TheCROSSLISToptionlooksthesameasLISToption,buttherearefewdifferencesasshownbelow.

CROSSLISTLIST

StatisticsFREQUENCYFREQUENCY

PERCENTPERCENT

ROWPERCENTCUMULATIVEFREQUENCY

COLUMNPERCENTCUMULATIVEPERCENT

TotalsProducessubtotalsandfinaltotals.Nototals

RowswithDisplaythevariablelevelswithSuppressthevariablelevelswith

zerofrequencieszerofrequencies

zerofreq

PROCMEANSonlybeperformedonnumericdata

∙Thisproceduregivesthefollowingsummarystatistics(ifnooptionsarespecified)foreachvariablelistedintheVARstatement:

numberofobservations,mean,standarddeviation,minimumvalue,maximumvalue,andstandarderrorofthemean.

∙Options:

Youcanselectwhichstatisticsyouwanttohaveprintedfromthefollowinglist:

N,NMISS(numberofmissingvalues),MEAN,STD,VAR,MIN,MAX,SKEWNESS,KURTOSIS,lclmanduclmoptionsprodu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1