全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2408 11
2013-10-11

谢谢各位大神了,真的是没有一点想法啊。感谢

Input requirement:

Write a macro called XSCAN which has 3 positional parameters:

· STRING – A text string containing a list of words.

· DELIMITER – A single character used to separate the words in STRING.

· WORD_NUMBER-An integer specifying the Nth word in STRING.  If the value is positive, count from the left of the string.  If the value is negative, count backward from the right of the string.

Processing requirement:

Derive the substring of STRING which starts with the Nth word in STRING, as described in the WORD_NUMBER parameter above.

Output

The substring should be printed to the SAS Log when the macro is called.

Examples:

Call

%xscan(a bb ccc dddd bb eeeee, %str( ), 1)

Result

a bb ccc dddd bb eeeee

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-10-11 10:00:20
例子跟要求不符啊,位置为1时,第1st word 就是a啊,怎么会出来那个结果?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-10-11 10:04:50
谢谢啊,
再多两个例子,这样清楚点了么
Call               
%xscan(%str(a,bb,ccc,dddd,bb,eeeee), %str(,), 3)
Result               
ccc,dddd,bb,eeeee

Call               
%xscan(a bb ccc dddd bb eeeee, %str( ), -2)
Result               
bb eeeee
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-10-11 10:43:02
复制代码
好吧, 哥承认自己写的很麻烦,如果你认为对你有所帮助的话,请在右下角评分中给我加几分吧
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-10-11 11:21:15
Imasasor 发表于 2013-10-11 10:43
好吧, 哥承认自己写的很麻烦,如果你认为对你有所帮助的话,请在右下角评分中给我加几分吧
太感谢了!评分有点少吧,真不好意思
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-10-11 12:55:26
Imasasor 发表于 2013-10-11 10:43
好吧, 哥承认自己写的很麻烦,如果你认为对你有所帮助的话,请在右下角评分中给我加几分吧
好 想评分竟然不能
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群