如何在下周五获得sas

时间:2018-05-01 20:29:14

标签: sas sas-macro

friday=intnx('week.5',today(),0)

这是下周五获得的正确逻辑吗?

1 个答案:

答案 0 :(得分:4)

在SAS中import numpy as np # Load images I = np.load("mnist_test_images.npy").astype(float) # (10000,784) L = np.load("mnist_test_labels.npy").astype(int) # (10000,1) # Scale I = 2.0*(I/255.0-0.5) images = len(I) # Random initialization of centers for k=10 clusters M = np.random.randn(10,28*28) guess = np.zeros((len(I),1)) step = 0 while (True): # Compute distance of every image i to the center of every cluster k # image i belongs to cluster with smallest distance for i in range(images): d = np.sum((M-I[i])**2,axis=1) guess[i] = np.argmin(d) # Update the centers for all clusters # New center is the mean of all images i which belong to cluster k for k in range(10): idx, _ = np.where(guess == k) if len(idx) > 0: M[k] = np.mean(I[idx],axis=0) # Test how good the algorithm works # Very similar to first step if (step % 10 == 0): fitness = 0 for i in range(images): dist = np.sum((M-I[i])**2,axis=1) if L[i] == np.argmin(dist): fitness += 1 print("%d" % fitness, flush=True) step += 1 是星期日,因此您需要检查1

6

输出: 今天是2018年1月1日

data test;
next_friday=intnx('week.6',today(),1);
following_friday=intnx('week.6',today(),2);
format next_friday date9. following_friday date9. ;
put _all_;
run;

注意: 根据SAS文档,0应显示当前一周,但它显示前一周,因为我们在这里使用了week.6,但是当使用1而不是正确的星期五被选中时。