a********e 发帖数: 3771 | 1 Wow! It's an interesting problem. My code is like this.
proc sort data = one; by id StateDate; run;
data two;
set one;
by id;
if first.id then do;
date1 = StartDate; date2 = EndDate; end;
else do;
if StartDate => date1 then do;
if StartDate =< date2 + 30 AND EndDate > date2 then date2 =
EndDate;
else do;
date1 = StartDate; date2 = EndDate;
end;
end;
end;
retain date1 date2;
id_date1 = id || date1;... 阅读全帖 |
|
f*******i 发帖数: 8492 | 2 我现在已有一个sas格式现成的data sheet
其中date1的格式是这样的 21MAY2001:00:00:00
但这组数据是character, 而不是date value
所以我需要把这组数据转换成sas的date value,并且减去 "01JAN2001"得到差值
我的code如下:
data homework10;
set class.homework10;
date2=input(date1,date9.);
format date2 date9.;
range=date2-'01JAN2001'dt;
run;
proc print data=homework10;
var date1 date2 range;
run;
现在我的问题,经过打印,我得到的date2确实只是date1里面的日期部分
1. 我所有的date2数值理论上都是大于01JAN2001这个值的,但是得出的range都是负值
,这事怎
么回事? 比如“-1277926548”。
2. 如何把range这个数据以“天数”的形式表示?
谢谢 |
|
f*******i 发帖数: 8492 | 3 是这样的,我已经有一个datasheet,homework10.sas7bdat
然后,其中的date1格式就是“21MAY2001:00:00:00”, 但这个不是numeric value,
而是character
所以我根据楼上说的,先把date1读写为numeric value的date2,再从中提取date部分
data homework10;
set class.homework10;
date2=input(date1,date16.);
format date2 date16.;
date3=datepart(date2);
format date3 date9.;
range=date3-'01JAN2001'dt;
run;
proc print data=homework10;
var date1 date2 date3 range;
run;
如果时间格式是“21MAY2001:00:00:00”, 那么datetime后面跟着的数字是应该取15,
16,17,还是18?
我现在无论取那个数,得到的date2,都是这种格式“21MAY01:00:00:00”,并... 阅读全帖 |
|
l*********l 发帖数: 2371 | 4 %macro run_code;
*%let start=%sysfunc(inputn('01feb09'd,anydtdte9.));
*%let end=%sysfunc(inputn('01jun13',anydtdte9.));
%let start=%sysfunc(inputn('01dec11'd,anydtdte9.)); %put &start;
%let end=%sysfunc(inputn('01feb12'd,anydtdte9.));
/*determines the number of months between the two dates*/
%let dif=%sysfunc(intck(month,&start,&end));
%do i=0 %to &dif;
%let date =%sysfunc(putn(%sysfunc(intnx(month,&start,&i,b)),yymmn6.)
);
%let date2=%sysfunc(putn(%sysfunc(in... 阅读全帖 |
|
d*********g 发帖数: 349 | 5 有两个table已经存在sas系统里了,第一个table 6百多万行,有个date1 column, 格
式都是像 01Jan2012:00:00:00
第二个table 7百多万行, 有个date2 column,格式都是像 01Jan2013:00:00:00:000
第一步把两个table join 起来,date1 和 date2 这两个columns 都需要在里面。这一
步已经做完了。下一步是比较每一行里面的date1 VS date2, 如果date1 在date2 之前
,在comment column里面写 before; 如果date1 在date2 之后,在comment column里
面写after.
请问大家,如何比较快速的把所有date1 date2转变成可以比较大小的日期格式,什么
格式?
谢谢!!! |
|
k*******a 发帖数: 772 | 6 my code, date1 is start time date2 is stop time(different from your
date2)
data A;
input date $ y;
datalines;
2/1 0
2/2 1
2/3 1
2/4 0
2/5 0
2/6 1
2/7 0
2/8 1
2/9 1
2/10 1
;
run;
data b;
set a;
lagy=lag(y);
if y^=lagy then group+1;
run;
data b(keep=date1 date2 count);
retain date1 date2;
set b;
by group;
if y=1;
if first.group then do;
count=0;
date1=date;
end;
count+1;
if last.group then do;
date2=date;
output;
end;
run;
proc pr... 阅读全帖 |
|
l********u 发帖数: 195 | 7 OrderNo lineNo Status LineType Date1 Date2
1 0001 99 T 07092002(date1)
1 0002 99 S 07012002(date2)
1 0003 50 S
2 0001 99 S 07012002(date2)
2 0002 99 S 07012002(date2)
3 0001 50 T 07092002(date1)
3 0002 99 S 0 |
|
b******e 发帖数: 539 | 8 suppose date1 = '19600210', use:
date2 = input(date1, yymmdd8.);
to convert '19600210' to a SAS date.
you can format date2 to any date format you want. for example, you can use
date9:
format date2 date9.;
then date2 will be shown as 10feb1960 |
|
t**********r 发帖数: 182 | 9 Want to merge two data sets using proc sql:
Data1:
var1 var2 date1
Data2:
var1 var2 date2 rating
(Note: var1 and var2 are the same variables in these two data sets)
Question:
Select rating in data2 to data1; meeting the following criteria:
1. date1 - date2 >0
2. date1 - date2 has the minimum value.
I wrote the following code; but it won't work:
proc sql;
create table data3 as
select data1.*, data2.rating, date1-date1 as diff
from data1, data2
where data1.var1=data2.var1 and data1.var2=data2.var2 |
|
m********s 发帖数: 55301 | 10 closing date2-3之后才交钥匙?
那买家能在closing date2-3之后再给卖方钱吗?
按照listing price出了offer. 现在buyer 要求提高earnest money 从1500到2500。还
有就是要求closing date2-3之后才交钥匙........ |
|
a****r 发帖数: 4965 | 11 What is the expiration date of your current EAD? Date1
What is the receipt date of your 485 EAD extension application? Date2
* If Date2 > Date1, you have to wait for your new EAD approval or ask the
company to file H1B for you (if possible).
* If Date2 <= Date1, you have 180 days auto-extension of your current EAD,
then you can work for the new company before the new EAD approval up to 180
days.
(Search "auto EAD extension" on USCIS.gov) |
|
t**********r 发帖数: 182 | 12 Want to merge two data sets using proc sql:
Data1:
var1 var2 date1
Data2:
var1 var2 date2 rating
(Note: var1 and var2 are the same variables in these two data sets)
Question:
Select rating in data2 to data1; meeting the following criteria:
1. date1 - date2 >0
2. date1 - date2 has the minimum value.
I wrote the following code; but it won't work:
proc sql;
create table data3 as
select data1.*, data2.rating, date1-date1 as diff
from data1, data2
where data1.var1=data2.var1 a |
|
m********5 发帖数: 619 | 13 你这个条件1和条件2我看着怎么重叠啊....
proc sql; create table data3 as select a.*, b.* from data1 as a, data2 as b
where a.var1=b.var1 and a.var2=b.var2 and a.date1-b.date2>=minvalue and a.
date1-b.date2>0;
quit; |
|
O******i 发帖数: 269 | 14 最近面了一家IT大公司被拒,一共经历了N轮技术面试。自己感觉还不算太坏,但也有
三轮发挥不太完美,所以心里很没底。
结果还是被拒了。
下面是这三轮的详细经历,请大家探讨一下大公司招人的标准。
第i轮是找二叉树从根开始的所有路径,使得该路径上所有节点的值之和等于一个给定
的数。我犯了一个战略错误,因为我在准备过程中看过CarrerCup的更通用的解法,不
要求从根开始,也不要求到叶子结束,于是我直接用了那个思路,在白板上写下了类似
下面的代码
void FindPath(Node* root, int sum, int path[], int level)
{
if (root == NULL)
return;
int s = 0;
for (int i = 0; i < level; i++)
s += path[i];
int value = root->data;
if (s + value == sum)
PrintPath(path, level, value);
path[leve... 阅读全帖 |
|
O******i 发帖数: 269 | 15 我要是当时看过题目二就好了,哎...
题目一,我的面经,出处
http://www.mitbbs.com/article_t/JobHunting/32010769.html
有一个类,里头有两个Date对象
class T
{
Date date1;
Date date2;
}
其中Date是形如12/05/2011这样的日期,date1 <= date2,这样T就表示一个时间段。
假如有两个T类型的变量a,b,如果a和b代表的时间段之间没有gap, 也就是a和b
overlap, 则集合{a, b}是连续的。然后他解释扩展到多个时间段,什么情况下他们的
集合是连续的。
他的问题是,给你一个T类型变量的list,如何判断这个list是连续的还是不连续的。
我很快发现,每个Date在时间轴上是一个点,每个时间段T的变量是时间轴上的一条线
段,这题完全可以等同于
class Seg
{
int start;
int end;
}
其中 start <= end, 这样Seg就表示数轴上的线段。两条线段如果overlap,包括
overlap于一个点,则连续... 阅读全帖 |
|
发帖数: 1 | 16 if expired, then you can't, since new company need you provide proof of
employment status, to do I9, you need to wait for new card
if your card is not expired. then go head, nothing for the company to do
: What is the expiration date of your current EAD? Date1
: What is the receipt date of your 485 EAD extension application?
Date2
: * If Date2 |
|
|
G***l 发帖数: 355 | 18 这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
果,比如:
用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
值(从数据库或者什么地方读过来的)。然后写,
//evaluate里做parsing和interpret
result = evaluate(monthControl, inputData)
if(result)
{
//do business logic
}
这样用户就可以写dsl直接控制我程序里的logic。假如改用haskell用embedded的话,
我的haskell程序没法直接调用那个dsl,除非把那个dsl写到我的source code,然后动
态编译运行,但是我不想要那样。或者可以有什么类似swig之类的东西让我动态调用
haskell code,但是我没法... 阅读全帖 |
|
G***l 发帖数: 355 | 19 这个是很好,但是好像也偶缺陷。比如我以前用Java写,用户输入是各种文本,然后在
后台程序里,我在Java里面把这些文本parse成AST并且interpret,最后得到他们的结
果,比如:
用户写的dsl是MonthDiff(Date1, Date2) + 1 > SomeValue
我读入这个文本到monthControl, 并且在inputData里放入Date1, Date2, SomeValue的
值(从数据库或者什么地方读过来的)。然后写,
//evaluate里做parsing和interpret
result = evaluate(monthControl, inputData)
if(result)
{
//do business logic
}
这样用户就可以写dsl直接控制我程序里的logic。假如改用haskell用embedded的话,
我的haskell程序没法直接调用那个dsl,除非把那个dsl写到我的source code,然后动
态编译运行,但是我不想要那样。或者可以有什么类似swig之类的东西让我动态调用
haskell code,但是我没法... 阅读全帖 |
|
w*s 发帖数: 7227 | 20 Ok i found this code online, works fine except i want to see date in the
xlabel.
import numpy as np
import pandas
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick, candlestick2
import matplotlib.dates as mdates
from pandas.io.data import DataReader
import datetime
# get daily stock price data from yahoo finance for S&P500
start = datetime.datetime(2015, 11, 1)
end = datetime.datetime(2016, 2, 11)
SP = DataReader("spy", "yahoo", start, end)
SP.reset_index(inplace=True)... 阅读全帖 |
|
y******0 发帖数: 401 | 21 proc sql;
create table data3 as
select data1.var1,data1.var2, data2.rating, min(date1-date2) as diff
from data1, data2
where data1.var1=data2.var1
and data1.var2=data2.var2
and date1>date2
group by 1,2,3;
quit; |
|
k*****u 发帖数: 1688 | 22 data test1;
input id date mmddyy10.;
cards;
01 1/2/1999
01 2/2/1999
02 3/3/1999
03 4/3/2000
;
run;
data test2;
input id date2 mmddyy10.;
cards;
01 12/2/1998
02 3/4/2000
03 3/3/1993
;
run;
data new;
merge test1 test2;
by id;
run;
data new1 (keep = id date);
set new;
where date
format date mmddyy10.;
run; |
|
S********a 发帖数: 359 | 23 有100个数据,有个变量名叫:date, 数据是06/17/2008这种形式的
我想把数据分成三个dataset,07/20/2008前,07/20/2008~09/17/2008, 09/17/2008
以后
data b c d;
set a;
format date DATE9.;
date1 = '20JULY2008'd;
date2 = '17SEPT2008'd;
if date < date1 then output b;
if data > date2 then output d;
else output c;
run;
出了error msg : Invalid date/time/datetime constant '20JULY2008'd.
Invalid date/time/datetime constant '17SEPT2008'd.
麻烦帮我看看,我自己觉得没错啊,但是就是不行。
包子答谢! |
|
s***r 发帖数: 1121 | 24 How can I merge 3 datasets using PROC SQL?
Dataset 1:
Plant date1 Variable1
Unique YYYYMMDD
ID
001 20060914 .....
001 20080801 .....
001 20080822
001 20100101
002 20011119
002 20020101
002 20030808
003 20091212
005 20000816
005 20001225
005 20010205
005 20030203
005 20030501 ....
...
...
....
Dataset 2:
Plant date2 Variable2
Unique YYYYMMDD
ID
001 20050314 ... 阅读全帖 |
|
h******e 发帖数: 1791 | 25 time to event是如何计算的?是date2 - date1 + 1还是date2 - date1?谢谢。 |
|
s******8 发帖数: 102 | 26 我也试一下:
你的问题是数据太大,而又必须排序.所以在排序方法上着手. 若你知道日期跨度,第一
步安天拆分数据,然后对每天排序并检查,最后把结果合并起来.
假如最早date as macro variable Day1, last date as macro variable day2;
%let date1=mdy(1,1,1990);
%let date2=mdy(12,31,2012);
%macro trybest(day1=&date1,day2=&date2);
data %do i=&day1 %to &day2;dt_&i %end;;
set yourdate;
select(date);
%do i=&day1 %to &day2;
when(i) output dt_&i;
%end;
otherwise put "ERROR: other date found " date;
end;
drop date;
run;
%do i=&day1 %to &day2;
%let dsid=%sysfunc(open(dt_&I,i));
%let nobs=%sysf... 阅读全帖 |
|
p***7 发帖数: 535 | 27 现在我的date数据有两种形式: 10NOV05或者 10NOV05:03:49:19, 我需要不同的处
理: if date.......then date2=datepart(date); else if date.......then date2=
date; 省略号处如何写呢?Thanks!! |
|
t**********r 发帖数: 182 | 28 Thank you.
你这个条件1和条件2我看着怎么重叠啊....
No. There are many obs that meet date1 - date2 >0; but I only want the one
with the min value. |
|
t**********r 发帖数: 182 | 29 Many thanks for your hint!! I made it. Here is the code.
579 proc sql;
580 create table data3 as
581 select data1.*, data2.rating, day1-day2 as diff
582 from data1, data2
583 where data1.var1=data2.var1 and data1.var2=data2.var2
584 and date1-date2>0
585 group by data1.var1, data1.var2, data1.date1
586 having diff=min(diff);
NOTE: The query requires remerging summary statistics back with the original
data.
NOTE: Table WORK.data3 created, with 48144 rows and 9 |
|
c**********0 发帖数: 836 | 30 fastlane上的external review date 是panel review date. reviewer在这个date2-
3个星期前开始审proposal. 然后在fastlane上给的external review date到nsf参加panel
discussion. 我比较过我fastlane proposal的external review date 和NSF给的panel
discussion date, 完全吻合. |
|
f*********m 发帖数: 549 | 31 按照listing price出了offer. 现在buyer 要求提高earnest money 从1500到2500。
还有就是要求closing date2-3天之后才交钥匙。问了我的agent,说这个很普遍。很多
seller怕不能closing。
我们最后加了一个附件,要求他们保证closing之后房屋不会被damage,还有搬家的时候
得损坏要由seller的insurance conver.
这样可以了吗? |
|
w******u 发帖数: 486 | 32 想问一下
我的一张visa 的信用卡去年12月份到期,需要在网上买东西,给BOA打电话
说才寄出来。估计得下个星期才能到
记得除了expire date
其他都不变的,但是不记得是expire date是更新到几年之后了
有人知道的么?
谢谢阿 |
|
|
|
k*****c 发帖数: 1670 | 35 normally, card number will not change, but the secure code might change. |
|
y****i 发帖数: 17878 | 36 just make up an expiration date and see if it goes through |
|
|
w******u 发帖数: 486 | 38 嗯。只有一张。。要那么多做什么。。
管理不过来,账单太多 |
|
|
B******5 发帖数: 4676 | 40 哦,这个版上的同志会建议你多申几张,有助于信用记录,云云。。。 |
|
|
g*********e 发帖数: 55 | 42 从怀孕开始到现在都在宝宝版学习,现在宝宝7周大了,交上我迟到的产经。
1.一变再变的催产日期:
因为孕晚期没有任何发动的迹象,而且我妈生我也overdue很久,所以我一直有预感女
儿会
overdue。起初我和LG的概念中overdue会引起胎儿过大,胎盘老化等等,所以倾向于一
过due
date就催。偏偏医院的规定是只有过了due date一周才给催,我们一听还觉得太迟了。
到了due
date 内检,胎头位置还是-2,开指1都不到,可见宝宝丝毫没有要出来的意思。恰好我
的OB在due
date 的下个礼拜休假,她就提议在她走之前让宝宝出来,就这样定下了due date2天后
催产,OB
说到时会先上软化剂,过10来个小时左右再上催产素 --- 我暗想居然会这么漫长啊。
在催的前一天晚上我看到了版上的一个催产转C的帖子,巧合的是LZ胎位跟我一样,开
指和软化度都
还比我略好些, 最后好像是因为宝宝头太上, 只能去C。我开始怀疑在-2的位置催产是
否是bad
idea。LG 下班回来听到我主意变了觉得很突然还有点不乐意。那天晚上临时抱佛脚做
了大量的关于
入盆和催产的research, |
|
d****a 发帖数: 478 | 43 非常感谢mm细致的解说。
难怪我现在点进baby registry只看到我add to baby registry的item,什么redeem
link都看不到,原来是要离due date2个月内才行的。呵呵。
那多问一句,这个能和prime会员同时用吗?
redeem |
|
s***e 发帖数: 1203 | 44 RD是2月6号,notice date2月10号。每次去uscis首页那个case status用receipt
number查,都说找不到。总觉着是最近交的太多了,系统更新忙不过来。
时间差不多的大家都查了么?开始怀疑自己是不是过分乐观了。 |
|
发帖数: 1 | 45 自己胡写的,不知道对于自己的这个特例这个写法行不行,各种名词的表达也简直吃不
准。不是给RFE,是个fresh的submit。谢谢好人们!
June 19th, 2016
USCIS
Attn: AOS
2501 S. State Hwy, 121 Business
Suite 400
Lewisville, TX 75067
Dear Sir/Madam,
I am in the category of EB-1A, extraordinary ability, and do not need an U.S
. employer to act as a sponsor/petitioner for my Green Card application.
I had been working in AAAA for the past years, and my term was just ended on
Date1 due to the fact that my H1B visa has reached the six year limit. I am
now in Change of... 阅读全帖 |
|
i**********p 发帖数: 1341 | 46 我没说javascript library有bug,我说的是usatt网站的bug. more specifically:
1. javascript library interface design很误导,month从开始,day从1开始,这是
不坑人是什么
2. 注意我post的title是"usatt league网站的bug"。usatt网站没有意识到month从0开
始,默认从1开始,这个inconsistency是个bug
FYI,bug出在usatt网站的dateStringCompare里用了
var date1 = new Date(year1, month1, day1);
var date2 = new Date(year2, month2, day2);
我几个小时之前给他们写信后,建议了fix (把month -1)。他们承认了这个问题,号称
已经fix了,你可以去check dateStringCompare是不是修正了(我没去check过)。估
计你试的时候已经是after fix了,所以正常。
// 这和浏览器无关。大浏览器的javascript int... 阅读全帖 |
|
e***t 发帖数: 1 | 47 Use DateDiff function for the first one:
datediff(hh, date1, date2)
use decimal or numeric for the second one, you can declare it as
decimal(10,2) |
|
d*r 发帖数: 238 | 48 I am working on an asp.net application using c#.
It queris a database and shows the query result as a line of title followed by
a table ( I used Label + DataGrid).
For example, for a Sale database, the web form shows
Date: (in a Label)
Sales: (in a DataGrid)
Now, the user wants to query more than one date and shows the result in one
web form which looks like:
Date1:
Sales1:
Date2:
Sales2:
Date3:
Sale3
...
Since I don't know how many dates the user want to query, I cannot fix the
design the of we |
|
p****r 发帖数: 165 | 49 is there a way to find a corresponding function in c/c++ that could count
calendar year/month , which is similar to YEARFRAC(Date1,Date2,1)? Thanks. |
|
t**********r 发帖数: 182 | 50 Has figured it out. Thanks.
===============
579 proc sql;
580 create table data3 as
581 select data1.*, data2.rating, day1-day2 as diff
582 from data1, data2
583 where data1.var1=data2.var1 and data1.var2=data2.var2
584 and date1-date2>0
585 group by data1.var1, data1.var2, data1.date1
586 having diff=min(diff);
NOTE: The query requires remerging summary statistics back with the original
data.
NOTE: Table WORK.data3 created, with 48144 rows and 9 columns.
587 quit;
NOTE: PROCEDURE SQL used (Tota |
|