开发者

regarding the meaning of "put" in SAS

what does the following SAS statement mean?

select(substr(put(customerID, 4.),3,2));

Especially, what do the three parameters 4., 3, and 2 stand for?开发者_JAVA百科 Thanks


You are first converting customerID to a character format so that you can extract a string from it using the substr function.

put(customerID, 4.)

Converts a numeric value to a character value of length 4.

substr(myvar,3,2)

Returns the substring of length 2, starting from position 3 (from the left) of string myvar. In SAS, the very first character on the left is position 1, compared to most other programming languages and the world of computer science where you start with 0. myvar MUST be a character (string) variable.

I'm not familiar with the select() function, but your question seemed geared towards the substr and put functions.


The SELECT looks like it is part of a case statement where your logic will branch depending upon what is contained in the select function:

Example:

select (a);
   when (1) x=x*10;
   when (2);
   when (3,4,5) x=x*100;
   otherwise;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜