SAS中_N_代表什么意思呢?

我看文献上说_N_代表读取数据集的条数,很模糊的意思,不是很懂,请教高人解答一下。data shoes; infile 'c:\tlsb\shoesales.dat'; input name $ 1-15 type $ sales;run;proc means noprint data=shoes; var sales; output out =summarydata sum(sales)=total;run;proc print data=summarydata;run;data summaryshoes; if _n_=1 then set summarydata; set shoes; percent=sales / total * 100;run;proc print data=summaryshoes; var name type sales total percent;run;我知道黄色是代表将两个数据集合并,但不知道什么原理,希望讲解一下。

  SAS中_N_代表:_n_是data步的自动变量,_n_表示观测的序号。通俗一点就是“表格的第几行”。_n_不在数据集中,但可以用一个变量来表示——就是“t=_n_;”。
  SAS(全称STATISTICAL ANALYSIS SYSTEM,简称SAS)是全球最大的软件公司之一,是由美国NORTH CAROLINA州立大学1966年开发的统计分析软件。
  SAS系统基本上可以分为四大部分:SAS数据库部分;SAS分析核心;SAS开发呈现工具;SAS对分布处理模式的支持及其数据仓库设计。它由数十个专用模块构成,功能包括数据访问、数据储存及管理、应用开发、图形处理、数据分析、报告编制、运筹学方法、计量经济学与预测等等。
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-06-12
_N_ indicates the number of times SAS has looped through the DATA step. This is not necessarily equal to the observation number, since a simple subsetting IF statement can change the relationship between observation number and the number of iterations of the DATA step.
第2个回答  2013-06-12
_N_ is SAS's built-in case counter,is an internal SAS counter in the data step which contains the current iteration number of the data step.本回答被网友采纳
相似回答