SAS access to MS-ACCESS files

I got a new laptop and my SAS lost access to MS-ACCESS files.

The problem was that my old SAS was a 32 bit system.  My new SAS is 64.

Here are the steps to fix:

  • Remove Microsoft Access Database Engine 2010 (English) .  By this I am removing the 32bit related patch.  I found this I think in the add and install program.
  • Install AccessRuntime_x64_en-us.exe (https://www.microsoft.com/en-us/download/details.aspx?id=39358)
  • Use this in SAS syntax ("access" is new; it used to be "pcfiles").

libname john access path="C:\Users\19702\Documents\(07) JSU i3 new\raw\dataset_011.accdb";

 

 

 

One more R function question

This below basically works, but 'var1' is not working.   In SAS, this would be "&var1".  How do I do that in R?

kaz_macro2<-function(var1){
x1<-  Summarize(GrowthMindset ~ treat+ dataID, data=var1)
x1$varname<-"GrowthMindset"
x1$sample_type<-'var1'
x2<-   Summarize(SelfEfficacy ~ treat+ dataID, data=var1)
x2$varname<-"SelfEfficacy"
x2$sample_type<-'var1'
x3<-   Summarize(MSelfEfficacy ~ treat+ dataID, data=var1)
x3$varname<-"MSelfEfficacy"
x3$sample_type<-'var1'
x4<-   Summarize(MathAnxiety ~ treat+ dataID, data=var1)
x4$varname<-"MathAnxiety"
x4$sample_type<-'var1'
x5<-   Summarize(TeacherUse ~ treat+ dataID, data=var1)
x5$varname<-"TeacherUse"
x5$sample_type<-'var1'
as.data.frame(rbind(x1,x2,x3,x4,x5))
}
temp1234<-kaz_macro2(wholedata2)

How to write a function to do these?

I have a repetitive process in R and I want to get this done in one function.  Could you help?

result1<-Summarize(GrowthMindset ~ treat+ dataID, data=wholedata2)
result1$varname<-"GrowthMindset"
result1$sample_type<-"Whole"

#Scale 2
result2<-Summarize(SelfEfficacy ~ treat+ dataID, data=wholedata2)
result2$varname<-"SelfEfficacy"
result2$sample_type<-"Whole"

#Scale 3
result3<-Summarize(MSelfEfficacy ~ treat+ dataID, data=wholedata2)
result3$varname<-"MSelfEfficacy"
result3$sample_type<-"Whole"

#Scale 4
result4<-Summarize(MathAnxiety ~ treat+ dataID, data=wholedata2)
result4$varname<-"MathAnxiety"
result4$sample_type<-"Whole"

#Scale 5
result5<-Summarize(TeacherUse ~treat+  dataID, data=wholedata2)
result5$varname<-"TeacherUse"
result5$sample_type<-"Whole"

 

The solution (thanks Isaac):

kaz_macro2<-function(var1){
x1<- Summarize(GrowthMindset ~ treat+ dataID, data=var1)
x2<- Summarize(SelfEfficacy ~ treat+ dataID, data=var1)
x3<- Summarize(MSelfEfficacy ~ treat+ dataID, data=var1)
x4<- Summarize(MathAnxiety ~ treat+ dataID, data=var1)
x5<- Summarize(TeacherUse ~ treat+ dataID, data=var1)
as.data.frame(rbind(x1,x2,x3,x4,x5))
}
temp1234<-kaz_macro2(wholedata2)

 

 

R function not working (but I got an answer on Reddit)

以下、誰のPCでも走るようにサンプルを書きました。

Rですが、私自身が書いたFUNCTIONでなぜ、result_dataという名のデータが、SAVEされないのかが分かりません。アドバイスお願いします。(回答はREDDITでいただきました。最後のところに書き込みました)。

最初のところで仮のデータを作る部分がややこしくなっていますが、たまたま仕事で同僚が書いてくれたものです。

library(dplyr)
library(tidyverse)

 

#create fake data
junk1 <- c(1, 2, 2, 4, 3, 3, 4, 1)
junk1 <- data.frame(matrix(junk1,ncol=2, byrow=T))
colnames(junk1) <- c("id", "num")
junk1$j1_flag <- 1
library(data.table)
junk1 <- data.table(junk1)
junk1$id <- as.factor(junk1$id)
junk2 <- c(1, "F", 2, "M", 5, "F")
junk2 <- data.frame(matrix(junk2,ncol=2, byrow=T))
colnames(junk2) <- c("id", "gender")
junk2$j2_flag <- 1
junk2 <- data.table(junk2)

#merge
junk1_2<-merge(junk1,junk2,by='id', all=TRUE)

 

#以下が問題の部分です。なぜresult_dataという名のデータがSAVEされないのかがわかりません。

kaz_macro1<-function(var1,var2){
var1 %>%
mutate(newvar = j2_flag+100) ->var2
}
kaz_macro1(junk1_2,result_data)

 

REDDITで教えてもらいました。ファンクションの外でデータとしてセーブするように指定するとできました。

kaz_macro1<-function(var1){
var1 %>%
mutate(newvar = j2_flag+100)
}

result_data2<-kaz_macro1(junk1_2)

How can I print?

The following actually worked.

 

<html>
<head><title>Kaz's program</title></head>
<body>

Let's see.
<?php

include "ここにパスワードなどの情報があるファイルを";
$con=mysqli_connect($host,$user,$passwd,$dbname) or die ("Didn't connect, Man.");
$query="SELECT * FROM `vocab_list` where ID < 10";
$result=mysqli_query($con,$query)
or die ("Didnt work.");
$row=mysqli_fetch_assoc($result);

ここで、書きだしたいものの、以下のではだめのようです。
echo $row['word'];

?>

Does this print?
</body></html>