楼主: tianlai888
2043 9

[求助]高人:计划组装如何编程序问题? [推广有奖]

  • 0关注
  • 0粉丝

本科生

19%

还不是VIP/贵宾

-

威望
0
论坛币
46 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
540 点
帖子
44
精华
0
在线时间
57 小时
注册时间
2009-1-9
最后登录
2012-5-18

楼主
tianlai888 发表于 2009-1-9 23:07:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

求助高人:

有几种商品a、b、c。商品a是由a类零件(a1,a2,a3,a4,a5)组装起来的。商品b是由b类零件(b1,b2,b3,b4)组装起来的....。
而且,零件a1 1件、 a2 1件、a3 2件、a4 2件、a5 1件合起来组装成1件商品a。
零件b1 1件、 b2 1件、b3 2件、b4 1件合起来组装成1件商品b。
零件c1 2件、 c2 1件、c3 2件合起来组装成1件商品c。

现在仓库里有下列品种数量的零件:
商品  零件  数量
a      a1     7
a      a2     5
a      a3    12 
a      a4    10
a      a5     9
b      b1     9
b      b2     6
b      b3    10 
b      b4     8
c      c1     2
c      c2     5

求教?上面只是一个例子,实际有很多商品每天要计算,应如何编写SAS程序解决下列问题:
1、按某类商品零件的最大量组装?组装后仓库里还剩多少品种数量的零件?
 (既商品a最多组装5件,商品b最多组装5件,商品c不能组装)
2、有一个计划要求组装商品a  4件,商品b  2件?组装后仓库里还剩多少品种数量的零件?
谢谢!!!

二维码

扫码加我 拉你入群

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

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

关键词:编程序 sas程序 求助 高人 组装 编程序

回帖推荐

yongyitian 发表于7楼  查看完整内容

The following code gives the answer og Q1.1. For Q1.2 and 2 another variable need to be created in the select statement. Then do the calculation in the data step for testdata_4.Please note, an observation was added at the end of data.data testdata_1;input p $ C $ qt;cards;a      a1     7a      a2     5a  ...

本帖被以下文库推荐

沙发
marloneusa 发表于 2009-1-10 05:35:00
用SQL(or Access)编一个interface最直接和管用。 用SAS有点绕弯。只是建议。

藤椅
jundal 发表于 2009-1-10 14:16:00

用lingo求解吧,excel规划模块也行,相当简单啊。。。

板凳
tianlai888 发表于 2009-1-10 20:18:00

我的其它数据计算是用SAS,所以也想用SAS完成上面的问题,可编不出来,请高人帮帮我。

谢谢!!

报纸
tianlai888 发表于 2009-1-12 22:41:00

请问?  用SAS有点绕弯,是不是不好编。用什么思路?

SQL(or Access)是什么?

[此贴子已经被作者于2009-1-12 22:43:29编辑过]

地板
zhitler 发表于 2009-1-13 09:20:00
背包问题

7
yongyitian 发表于 2009-1-14 06:33:00

The following code gives the answer og Q1.1. For Q1.2 and 2 another variable need to be created in the select statement.

Then do the calculation in the data step for testdata_4.

Please note, an observation was added at the end of data.

data testdata_1;

input p $ C $ qt;

cards;

a      a1     7

a      a2     5

a      a3    12 

a      a4    10

a      a5     9

b      b1     9

b      b2     6

b      b3    10 

b      b4     8

c      c1     2

c      c2     5

c      c3     0  /* I added the obs */

;

run;

proc print data=testdata_1; run;

data testdata_2;

   set testdata_1;

   select (c);

        when ('a1') AProd=int(qt/1);

        when ('a2') Aprod=int(qt/1);

        when ('a3') Aprod=int(qt/2);

        when ('a4') Aprod=int(qt/2);

        when ('a5') Aprod=int(qt/1);

        when ('b1') Aprod=int(qt/1);

        when ('b2') Aprod=int(qt/1);

        when ('b3') Aprod=int(qt/2);

        when ('b4') Aprod=int(qt/1);

        when ('c1') Aprod=int(qt/2);

        when ('c2') Aprod=int(qt/1);

        when ('c3') Aprod=int(qt/2);

   otherwise;

   end;

run;

proc print data=testdata_2; run;

proc sort data=testdata_2 out=testdata_3;

    by p Aprod;

run;

proc print data=testdata_3; run;

data testdata_4;

    set testdata_3;

      by p;

      if first.p;

      keep p aprod;

run;

ods pdf file="D:\Mysas\SASData\Tempresults\Q1_1_Answer.pdf";

title 'Number of Product Can Be Built';

proc print data=testdata_4 noobs label;

     label     p = 'Product'

           aprod = 'Quantity';

run;

ods pdf close;

[此贴子已经被作者于2009-1-14 6:39:55编辑过]

已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

8
tianlai888 发表于 2009-1-14 20:32:00

非常感谢各位老师!!

    帮我解决了一个大问题,谢谢!!!!

9
nernernini 发表于 2009-1-16 04:11:00
learning

10
monicawang 发表于 2009-1-16 04:12:00
good to know.

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

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