楼主: 乾坤神龙
11213 13

[问答] 删除format [推广有奖]

  • 8关注
  • 1粉丝

硕士生

27%

还不是VIP/贵宾

-

威望
0
论坛币
2 个
通用积分
0
学术水平
4 点
热心指数
9 点
信用等级
5 点
经验
2341 点
帖子
78
精华
0
在线时间
196 小时
注册时间
2010-6-2
最后登录
2023-9-6

楼主
乾坤神龙 发表于 2012-5-29 15:03:11 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请问怎么将一个已有format的数据集,去掉format。因为带有foramt的数据集转移到其他电脑里面的时候总是需要先运行format,才能操作数据集,很麻烦。
求助求助!!
二维码

扫码加我 拉你入群

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

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

关键词:format FORMA form For RMA 电脑

回帖推荐

davil2000 发表于2楼  查看完整内容

One method invokes the "PROC DATASETS" procedure. 1. Start the SAS software package and load the SAS program. Locate the name of the dataset within the program that uses the desired formats. 2. Modify the dataset characteristics. Type the following code in the SAS editor to remove or drop an existing format: PROC DATASETS LIB=FormatLocation; MODIFY YourSASDatasetName; format _all_; RUN; ...

本帖被以下文库推荐

沙发
davil2000 发表于 2012-5-29 15:10:16
One method invokes the "PROC DATASETS" procedure.
1. Start the SAS software package and load the SAS program. Locate the name of the dataset within the program that uses the desired formats.
2. Modify the dataset characteristics. Type the following code in the SAS editor to remove or drop an existing format:

PROC DATASETS LIB=FormatLocation;
MODIFY YourSASDatasetName;
format _all_;
RUN;

where "FormatLocation" is the location of the SAS format (work, for example) and "YourSASDatasetName" is the name of the SAS dataset. Use the "format _all" option to drop all SAS formats or specify the format name in the place of "_all_".
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
数据分析师3K + 100 + 80 + 3 + 3 + 3 热心帮助其他会员

总评分: 经验 + 100  论坛币 + 80  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

R是万能的,SAS是不可战胜的!

藤椅
davil2000 发表于 2012-5-29 15:14:13
The other uses "DATA" steps. Both methods can be invoked to drop all formats associated with a particular SAS dataset or be limited to specific formats.

1. Start the SAS software package and load the SAS program. Locate the name of the dataset within the program that uses the desired formats.
2. Type the following code in the SAS editor:

DATA YourNewDatasetName;
SET YourCurrentDataset;
FORMAT _ALL_;
RUN;

where "YourNewDatasetName" is the newly created dataset and "YourCurrentDataset" is the name of the SAS dataset to be modified. Use the "format _all" option to drop all SAS formats or specify the format name in the place of "_all_".

3. Execute the piece of code.
4. Eventually, run a "PROC CONTENTS" to verify the removal of the formats.
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
Tigflanker + 1 + 1 + 1 观点有启发
拥抱大海的鱼 + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

R是万能的,SAS是不可战胜的!

板凳
乾坤神龙 发表于 2012-5-29 15:17:28
davil2000 发表于 2012-5-29 15:10
One method invokes the "PROC DATASETS" procedure.
1. Start the SAS software package and load the S ...
这位老大您好,非常感谢帮忙。除了这点问题之外,还有部分问题;
我需要处理多个数据集,将每个数据集里面的format按照数据集进行分别储存;
例如
数据集      format存储集
a1           a1f
a2           a2f
a3          a3f
本打算使用
proc format cntlout=b1 library=work;
run;
quit;
结果发现这个结果不能区分数据集,是将所有数据集的format集中到一起,所以我打算按照数据集分别处理,在处理完a1之后将所有的format去掉,在处理a2;使用上面的代码,发现数据集a1里面是没有了,但是在work里面还是有format的那个图标,使用proc format cntlout还是会输出a1的内容!!

报纸
davil2000 发表于 2012-5-29 15:40:26
Easy! For evey data set  ***, you can choose to keep only one obs, and save it as ***f.  In such a way, u can save format for each data set.
In the flllowing application, simply append the *** data set (in which formats  has been deleted ) to the data set   ***f,  and then delete the 1st obs.
Good luck!
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
拥抱大海的鱼 + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

R是万能的,SAS是不可战胜的!

地板
乾坤神龙 发表于 2012-5-29 16:11:17
davil2000 发表于 2012-5-29 15:40
Easy! For evey data set  ***, you can choose to keep only one obs, and save it as ***f.  In such a w ...
我还是上实例吧,这样比较方便:我有两个数据集,需要分别得到他们的format列表(真实情况是有很多个数据集,所以不能运行完一个之后关闭在运行另外一个);两个数据集分别为:
proc format;
value f1_fmt 1 = '研究药物' 2 = '对照药物';
value f2_fmt 1 = '男' 2 = '女';
run;
data a1;
format group f1_fmt. sex f2_fmt.;
label group = '组别' age = '年龄' sex = '性别';
do subid = 1 to 2;
   group = mod(subid, 2) + 1;
   age = 18 + int(ranuni(0) * 42);
   sex = ceil(ranuni(0) * 2);
   output;
end;
run;

proc format;
value f1_fmt 1 = '北京' 2 = '天津';
value f2_fmt 1 = '小学生' 2 = '中学生' 3='高中生' 4='大学生';
value f3_fmt 1 = '自费' 2 = '保险' 3='社保';
run;
data a2;
format group f1_fmt. edu f2_fmt. pay f3_fmt.;
label group = '城市' age = '年龄' edu = '学历' pay='付费方式';
do subid = 1 to 4;
   group = mod(subid, 2) + 1;
   age = 18 + int(ranuni(0) * 42);
   edu = ceil(ranuni(0) * 4);
   pay=ceil(ranuni(0) * 3);
   output;
end;
run;

我需要分别得到他们的format列表,我使用的方法是:
proc format cntlout=a1f;
run;

需要得到的format列表分别为
a1f
QQ截图20120529160940.png
a2f
QQ截图20120529161023.png
现在因为运行完前面的a1之后,a1的format还存在,如果在a2生成之后运行
proc format cntlout=a2f;
run;
那么a2f里面也会包含或者错误显示a1的format内容,所以想问一下能否在a1的a1f生成之后,将work里面的formats文件夹删除,使其不再影响a2f的内容

QQ截图20120529160940.png (4.72 KB)

QQ截图20120529160940.png

7
davil2000 发表于 2012-5-29 16:19:31
问题复杂(⊙o⊙)哦!
找论坛的数据中心吧
data.pinggu.org
R是万能的,SAS是不可战胜的!

8
数据分析师3K 发表于 2012-5-29 16:40:06
davil2000 发表于 2012-5-29 16:19
问题复杂(⊙o⊙)哦!
找论坛的数据中心吧
data.pinggu.org
回答问题也是有限度的
不可以指望别人做作业吧

9
yongjiang2 发表于 2012-7-3 10:41:53
学习

10
Bridgenc 发表于 2012-7-3 10:53:17
learned and thanks,

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-20 17:06