首页 \ 问答 \ SAS导出日期格式(SAS Export date format)

SAS导出日期格式(SAS Export date format)

嗨我正在尝试从一个日期文件夹导入数据(成功),所以文件路径读取/年/月/日(*今天的日期)

然后我调整了一些数据(再次成功)。 一旦完成,我想将它导出到一个文件夹,该文件夹是我从它取得的文件夹前29天。

这是我目前的宏:

%LET TODAY = %SYSFUNC(TODAY());
%PUT &TODAY;
%LET TODAYA = %SYSFUNC(PUTN(&TODAY,DDMMYYn8.));
%PUT &TODAYA;
%LET TWENTYNINE = %SYSFUNC(PUTN(&TODAY.+29,DDMMYYn8.)); 
%PUT &TWENTYNINE;
%LET T_DATE = %SYSFUNC(PUTN(&TODAY,DDMMYYn8..));
%LET T_YEAR = %SYSFUNC(YEAR(&TODAY));
%LET T_MONTH = %SYSFUNC(MONTH(&TODAY));
%LET P_DATE = %SYSFUNC(PUTN(&TWENTYNINE,DDMMYYn8..));
**%PUT &P_DATE;
%LET P_YEAR = %SYSFUNC(YEAR(&P_DATE));
%LET P_MONTH = %SYSFUNC(MONTH(&P_DATE));**

P_Date显示错误:

错误:由%SYSFUNC或%QSYSFUNC宏函数引用的参数1功能MONTH不是数字。 错误:在%SYSCALL,%SYSFUNC或%QSYSFUNC参数列表中检测到无效参数。 %SYSCALL语句或%SYSFUNC或%QSYSFUNC函数引用的执行已终止。

但是我无法得到我的头,任何帮助都会受到大力赞赏。


Hi I am trying to import data (successfully) from a folder that is a date so the file path reads /year/month/date (*today's date)

I am then tweaking some of the data (again successfully). Once that is done I want to export it to a folder that is 29 days forward from the folder I took it from.

Here is my current macro:

%LET TODAY = %SYSFUNC(TODAY());
%PUT &TODAY;
%LET TODAYA = %SYSFUNC(PUTN(&TODAY,DDMMYYn8.));
%PUT &TODAYA;
%LET TWENTYNINE = %SYSFUNC(PUTN(&TODAY.+29,DDMMYYn8.)); 
%PUT &TWENTYNINE;
%LET T_DATE = %SYSFUNC(PUTN(&TODAY,DDMMYYn8..));
%LET T_YEAR = %SYSFUNC(YEAR(&TODAY));
%LET T_MONTH = %SYSFUNC(MONTH(&TODAY));
%LET P_DATE = %SYSFUNC(PUTN(&TWENTYNINE,DDMMYYn8..));
**%PUT &P_DATE;
%LET P_YEAR = %SYSFUNC(YEAR(&P_DATE));
%LET P_MONTH = %SYSFUNC(MONTH(&P_DATE));**

The P_Date reveals the error:

ERROR: Argument 1 to function MONTH referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.

But I cant get my head around it any help would be massively appreciated.


原文:https://stackoverflow.com/questions/35010237
更新时间:2023-01-05 21:01

最满意答案

你是如何将Guids变成弦乐的?

您可以使用Guid.ToString("N")生成不带连字符的字符串guid。

您可能还必须在开头放置一个非数字 - 如果这样做,使用String.Format()可能最容易做到:

string guidStr = string.Format("X{0:N}", Guid.NewGuid()); // Prefix with "X"

How are you turning the Guids into strings?

You can use Guid.ToString("N") to produce a string guid without any hyphens.

You may have to put a non-digit at the start too - if you do, it's probably easiest to do it with String.Format():

string guidStr = string.Format("X{0:N}", Guid.NewGuid()); // Prefix with "X"

相关问答

更多
  • GUID似乎是你的主键的一个自然选择 - 如果你确实需要,你可能会争论将它用于表的PRIMARY KEY。 我强烈建议不要做的就是使用GUID列作为集群密钥 ,默认情况下,SQL Server 会这样做 ,除非您明确告诉它不要。 你真的需要分开两个问题: 1) 主键是一个逻辑结构 - 唯一可靠地标识表中每一行的候选键之一。 这可以是任何东西,真的 - 一个INT,一个GUID,一个字符串 - 选择对你的场景最有意义的东西。 2) 聚簇键 (在表格中定义“聚簇索引”的列或列) - 这是与物理存储相关的东西,在 ...
  • 如@bacar所述, RFC 4122§4.3定义了一种创建基于名称的UUID的方法。 这样做的优点(仅仅是使用MD5哈希)是这些保证不会与非命名的UUID相冲突,并且与其他基于名称的UUID有很小的可能性。 .NET Framework中没有本地支持创建这些,但是我在GitHub上发布了实现该算法的代码 。 可以使用如下: Guid guid = GuidUtility.Create(GuidUtility.UrlNamespace, filePath); 为了进一步降低与其他GUID冲突的风险,您可以 ...
  • 我从其中一个值(any)创建一个HashSet ,然后检查所有其他值是否等于它: // TODO: Handle the dictionary being empty var firstSet = new HashSet(values.First().Value); var allEqual = values.All(pair => firstSet.SetEquals(pair.Value)); 这假定: 每个清单中的顺序并不重要 每个GUID出现在列表中的次数并不重要 (即你真 ...
  • 如果你的意思是基于公共前缀的uuids,比如MAC和时间,请看看uniqid 。 在这里,您还可以找到符合RFC 4211的UUIDS的一些代码。 如果你想要安全起见,请将此包装器用于libuuid: pecl uuid 。 没有测试过,YMMV。 If you mean uuids based on a common prefix, such as MAC and time, have a look at uniqid. Here you can also find some code for RFC 4 ...
  • 如果这是针对聚集索引(通常是主键),那么我强烈推荐NEWSEQUENTIALID() (SQL Server 2005),因为NEWID()会在这种情况下创建一个分段索引,并且是真正的随机数。 If this is for a clustered index (most often a primary key), I highly recommend NEWSEQUENTIALID() (SQL Server 2005 on up) since, NEWID() will create a fragment ...
  • 虽然每个生成的GUID不能保证是唯一的,但唯一键(2128或3.4×1038)的总数非常大,以致两次生成相同数字的概率非常小。 你可以在这里查看更多信息。 避免重复的GUID(如果你仍然需要的话)的一个可能的解决方案是使用UNIQUE约束 。 While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4×1038) is so large that the prob ...
  • “聚合器必须将guid视为一个字符串。语法没有规则。这取决于RSS文档的创建者,以确定字符串的唯一性。” 资料来源: w3schools "Aggregators must view the guid as a string. There are no rules for the syntax. It's up to the creator of the RSS document, to establish the uniqueness of the string." Source: w3schools
  • 你是如何将Guids变成弦乐的? 您可以使用Guid.ToString("N")生成不带连字符的字符串guid。 您可能还必须在开头放置一个非数字 - 如果这样做,使用String.Format()可能最容易做到: string guidStr = string.Format("X{0:N}", Guid.NewGuid()); // Prefix with "X" How are you turning the Guids into strings? You can use Guid.ToString( ...
  • 这是Mysql .net连接器中的一个错误,请查看此错误报告以获取更多详细信息http://bugs.mysql.com/bug.php?id=52747 更新:在6.1.1之后,只要使用BINARY(16)作为存储类型,就应该在连接字符串中添加“old guids = true”。 否则你应该使用CHAR(36) This is a bug in Mysql .net connector check this bug report for more details http://bugs.mysql.co ...
  • 您的测试方法目前只有一个参数 - 字符串 - 但不一定是这种情况。 如果您的测试方法有3个参数怎么办? 你怎么把它打包成IEnumerable 因此,当您使用xUnit的“属性数据”功能时,xUnit要求该属性采用IEnumerable public static IEnumerable Guids { get { yield return new object[]{ "" }; yield re ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)